data output;
set datarolling_ETFS;
if rankdate < '20050630'YYMMDDN8. then delete;
run;
I have problem to define the format date
Edit by KB: Formatted code and put it in correct window.
We can use the date literals as below
data output;
set datarolling_ETFS;
if rankdate<'30Jun2005'd then delete;
run;
We can use the date literals as below
data output;
set datarolling_ETFS;
if rankdate<'30Jun2005'd then delete;
run;
Assuming your date is a numeric sas date formatted with yymmddn8
if rankdate<'30JUN2005'd then delete;
should work
However, you need to confirm whether or not your date is numeric or char
Proc contents should give you that information
The answer depends on what your variable actually contains.
It is a true SAS date? Then use:
if rankdate < '30Jun2005'd then delete;
Is it a six-digit number? Then use:
if rankdate < 20050630 then delete;
Is it a character variable of some sort? Then use:
if input(rankdate, 6.) < 20050630 then delete;
But you need to understand some basic information about what is in your variable to select the proper answer.
To keep the ymd date format, use the input() function:
data output;
set datarolling_ETFS;
if rankdate < input('20050630',YYMMDD8.) then delete;
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.