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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: