DATA df1;
Informat dob DDMMYY10. Date_ DATE9.;
Input @32dob DDMMYY10. @55Date_ DATE9.;
Format dob DDMMYY10. Date_ DATE9.;
DATALINES;
05/06/1990 23Dec2000
05/11/1991 20NOV2020
;
run;
I am new SAS programming. I would like to create data with dob and date column by using above code am Am getting output like below
dob Date_
. .
. .
Please, help me where am gone wrong.
When you use @32 and @55 in an INPUT statement, it tells SAS to read starting in column 32 and starting in column 55, and there is nothing in there.
This should work.
DATA df1;
Input dob :DDMMYY10. Date_ :DATE9.;
Format dob DDMMYY10. Date_ DATE9.;
DATALINES;
05/06/1990 23Dec2000
05/11/1991 20NOV2020
;
run;
When you use @32 and @55 in an INPUT statement, it tells SAS to read starting in column 32 and starting in column 55, and there is nothing in there.
This should work.
DATA df1;
Input dob :DDMMYY10. Date_ :DATE9.;
Format dob DDMMYY10. Date_ DATE9.;
DATALINES;
05/06/1990 23Dec2000
05/11/1991 20NOV2020
;
run;
is @32 ,@55 means we are telling SAS that column position?
@SASCODERS wrote:
is @32 ,@55 means we are telling SAS that column position?
Yes. With input the @ moves the input pointer to that character position on the line of text to be read. Then your next "instruction" such as reading a variable occurs depending to the actual line
Similar, an #n reads "on line number n" if the Infile has been set up to read multiple lines correctly.
Thank you for explaining.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.