comp.soft-sys.sas - The SAS statistics package.
I have a date field can be numeric and populated or character and blank (only these 2 scenarios) if it's populated it has this format MMDDYY10. numeric and if it's character then it's just blank. so what i need is for the numeric date to look like this: Numeric, Length 8, Format 11. and look like 20100214 and if it's character then convert it so it looks like 20100214. Thank you
I need to create a flat file which contains a 9 digit social security number with the leading zeros. My SAS dataset contains an ssn as a numeric variable. The SAS ssn format contains the dashes so that does not work in a put or input statement. Does anyone know of a put statement with a format that would work in the data _null_ step that creates the flat file? Or, does someone know of some other one-liner that would create the 9-digit ssn with leading zeros as another variable that could then be put to the flat file? Thanks.
Trying to Convert from Character to Numeric. Can anyone please let me know what may be possible wrong with the following coding: format birthdtn DATE9.; birthdtn=input(compress(birthdt, '-'), date9.); Getting following error: NOTE: Invalid argument to function INPUT at line 2308 column 14. SUBJID=0020033 SEX=Female BIRTHDT=19610424 birthdtn=. _ERROR_=1 _N_=1 NOTE: Invalid argument to function INPUT at line 2308 column 14. SUBJID=0020033 SEX=Female BIRTHDT=19610424 birthdtn=. _ERROR_=1 _N_=2 NOTE: Invalid argument to function INPUT at line 2308 column 14. Thank you.
I'm having problems converting my variable 'laystage', which is numeric (BEST12.), into a character variable. I created a new variable 'wave' for this, using "wave = laystage". However, the results are very confusing. Wave is still a numeric variable. The PUT statement seems to be doing the exact opposite - converting character values to numeric. Can anyone tell me what is going wrong? FYI, the values of laystage range from -7 to 7, in integers or numbers ending in .5. Here are the results from my Log window: 109 data mylib.loggers030405append4finalwoATFL; 110 set mylib.loggers030405append4finalwoATFL; 111 wave = PUT (laystage, BEST12.); NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). 111:8 NOTE: There were 1427 observations read from the data set MYLIB.LOGGERS030405APPEND4FINALWOATFL. NOTE: The data set MYLIB.LOGGERS030405APPEND4FINALWOATFL has 1427 observations and 74 variables. NOTE: DATA statement used (Total process time): real time 0.13 seconds cpu time 0.04 seconds And here's what PROC CONTENTS displays after the conversion: # Variable Type Len Format Informat Label 31 laystage Num 8 laystage 74 wave Num 8 laystage in text format