BookmarkSubscribeRSS Feed
Aexor
Lapis Lazuli | Level 10

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!

6 REPLIES 6
PaigeMiller
Diamond | Level 26

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. 

 

--
Paige Miller
CarmineVerrell
SAS Employee

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.

 

Ksharp
Super User
data have;
 set sashelp.stocks;
 fmt_date=fmtinfo(compress(vformat(date),,'ka'),'cat');
fmt_open=fmtinfo(compress(vformat(open),,'ka'),'cat');
run;

Ksharp
Super User

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;

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

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
  • 6 replies
  • 551 views
  • 3 likes
  • 4 in conversation