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!
As @AskoLötjönen stated, you have no data source in your data step, so A and B are not populated.
You probably want
data abcd.survey;
set abcd.survey;
if A < B then delete;
run;
You are missing set-clause, therefore all of your variables are uninitialized.
As @AskoLötjönen stated, you have no data source in your data step, so A and B are not populated.
You probably want
data abcd.survey;
set abcd.survey;
if A < B then delete;
run;
@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.
Thank you! That works very well. Yes, I am a new user of SAS and thanks for the explanation.
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: