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

I would like to enter blank values for dates using datalines.  I keep getting errors from the program below.  What placeholder do I need to enter in line Two for Scott in order to show a null for date?

 

data want;
length Rank $10 Name $8. Days 8. ;
input Rank Name $ Date date9. Days ;
format Date date9. ;
datalines;
One Joe 04Sep2018 30

Two Scott  20

Three Bob 04Sep2018 40

;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

do you mean this?

 


data want;
infile datalines truncover;
length Rank $10 Name $8. Days 8. ;
input Rank $ Name $ Date :date9. Days ;
format Date date9. ;
datalines;
One Joe 04Sep2018 30
Two Scott . 20
Three Bob 04Sep2018 40
;
run;

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

do you mean this?

 


data want;
infile datalines truncover;
length Rank $10 Name $8. Days 8. ;
input Rank $ Name $ Date :date9. Days ;
format Date date9. ;
datalines;
One Joe 04Sep2018 30
Two Scott . 20
Three Bob 04Sep2018 40
;
run;
arde
Obsidian | Level 7

oops, I had missed the colon in front of date9.

 

Thanks so much 🙂

HB
Barite | Level 11 HB
Barite | Level 11

s seems to read correctly:

 

data want;
	input Rank:$ Name:$ Date:date9. Days ;
	length Rank $10. Name $8. Days 8. ;
	format Date date9. ;
	datalines;
	One Joe 04Sep2018 30
	Two Scott . 20
	Three Bob 04Sep2018 40
	;
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 12009 views
  • 0 likes
  • 3 in conversation