Hi,
is there any way to find out the particular variable consist date values ?
I know we can run PROC contents , is there any other way to find out ??
Thanks!
You can look at the data set with your own eyes.
You can see if the variable name indicates that this is a Date (although there's no guarantee the variable name is correct)
And you can use Maxim 3, Know Your Data.
There are ,
1) visually you can open the data
2) if there is a data dictionary that exist.
3) there might be also labels included to describe what that column variable is.
data have;
set sashelp.stocks;
fmt_date=fmtinfo(compress(vformat(date),,'ka'),'cat');
fmt_open=fmtinfo(compress(vformat(open),,'ka'),'cat');
run;
Or you could try dictionary table instead of my data step .
data want;
set sashelp.vcolumn(where=(libname='SASHELP' and memname='STOCKS'));
is_date=fmtinfo(compress(format,,'ka'),'cat');
run;
The only problem with FMTINFO is that variables can be dates but not have a format, or they can be character (yes, I know they are not SAS dates, but they are human readable dates) as in this recent discussion. So, FMTINFO will work in some situations and not others, which is why Maxim 3 is so useful, it works in all situations, but it requires more effort on the part of the user.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.