

Put hos_date= * uses data set format of hos_date Note if you want to check what the internal value of HOS_date is in your work data set run the following code: Use built-in sas function and avoid system dependent commands:

HOS_DATE="&curdate"d Note the double quotes are important to get the macro variable resolved and quoting a date-like string and appending the character d at the end tells SAS this is a date value.Ģ. To fix, change your assignment statement to either:ġ. Since SAS dates are stored as the number of days since, a value of 0 =>, which is what is sent to Oracle.

When SAS is communicating to oracle, it takes its internal value and formats as a date string which Oracle can interpret. It then performs the arithmetic operation of 7 DIVIDED BY 19 DIVIDED BY 2013. The data step compiler sees HOS_DATE = and assumes HOS_DATE is a numeric variable because it does not see a quoted literal. Macro compiler: The statement HOS_DATE=&curdate is resolved to HOS_DATE = by the macro compiler.Ģ. Also Unix does the same but again with a different reference point.ġ. I believe oracle also stores as numeric count with a different base date but I could be wrong. Sas stores dates as numeric value representing the number of days since. What is the problem ? Where am I going wrong ? Thanks in advanceįirst some points about how both SAS and Oracle store dates. SYMBOLGEN: Macro variable CURDATE resolves to The date shows as in the Oracle Table, yet when I use a %Put (%put &curdate ) to display it in the SAS log it indeed shows as the true date as follows: Select HOS_DATE, STATION, CONTR_ID, CONTR_NAME, PRIM_SVC_AREA_ID, DRIVER_NBR, DRIVER_NAME, PCK_DELV_HRS, SPOT_HRS, LINEHAUL_HRS from work.safety_hrs I then set the Date I got from the Shell to a variable like so:Īn Finally the select into my Oracle table as follows: INFILE getin missover STATION CONTR_ID CONTR_NAME PRIM_SVC_AREA_ID DRIVER_NBR DRIVER_NAME PD_HRS SP_HRS L_HRS 5.2 In the program, I am parsing out records from a. ksh) and within the SAS program I am retrieving the Current Date from the shell as such: I am calling a SAS program from a Shell Script (Unix. Hi, I'm a SAS user for 1 week now, so complete rookie.
