BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASCODERS
Fluorite | Level 6

 

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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;

 

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

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;

 

--
Paige Miller
SASCODERS
Fluorite | Level 6

is @32 ,@55 means we are telling SAS that column position?

ballardw
Super User

@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.

 

 

SASCODERS
Fluorite | Level 6

Thank you for explaining.

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 562 views
  • 1 like
  • 3 in conversation