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

Hello,

 

As indicated in the subject I have 2 date variables A (format: 12DEC2012) and B (format: 20110908) in my data file. I use SAS 9.4 and the following codes, but it always shows A and B are uninitialized. I checked some information from the internet but still do not quite understand how to solve it. Is there anyone can help me figure out the problem?

 

Codes I use:

data abcd.survey;

if A<B then delete;

run;

 

Thanks!

1 ACCEPTED SOLUTION
4 REPLIES 4
AskoLötjönen
Quartz | Level 8

You are missing set-clause, therefore all of your variables are uninitialized.

 

 

ballardw
Super User

@Therain, I am going to  assume you are relatively new to using SAS. You want to be careful with the word "format" as it has a very specific meaning related to value display. Neither of the values you showed are formats. If the variables are SAS date valued variables then the formats respectively would be Date9. and YYMMDD8. Please confirm by running Proc Contents on the data set that the varibles are date values with formats shown above or is A character and B simply numeric (possibly format Best8. 8.0 or similar) or character.

 

 

Therain
Calcite | Level 5

Thank you! That works very well. Yes, I am a new user of SAS and thanks for the explanation.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 2547 views
  • 0 likes
  • 4 in conversation