Hi Paul D.,
Thanks for taking the time to watch and comment on this video! A few comments in response.
Creating a View instead of Rewriting our Data:
Great point about creating a view! You can do this with PROC SQL or the DATA step. To do it with the DATA step just specify the VIEW option on the DATA statement. Here is an example:
data race_new / view=race_new;
set race(rename=(race_date=race_date_old));
race_date=input(race_date_old, date9.);
format race_date mmddyy10.;
drop race_date_old;
run;
To look at the stored code in your view later, you can run a describe on the view:
data view=race_new;
describe;
run;
CATX and the length of NC_ID:
As you mentioned, the use of CATX here does create a column with a default length of 200 characters. If you run the code, there are actually no notes in the SAS log about this; however, doing a PROC CONTENTS on the newly created data set it is apparent, so let’s talk about how we can fix it. One easy fix is to use the length statement in the DATA step before the creation of the column. I can put this right after the SET statement, or if I want to maintain the order of my columns in my data set, I can put it right before I define the NC_ID column. Here is what that would look like:
length NC_ID $10.;
Showing the Log:
I agree, it is important to check out the log. I’ll be sure to highlight this more in future tutorials!
Again, thanks for taking the time to check out this tutorial. I hope you spend some more time exploring the other tutorials on the SAS Users YouTube channel!
... View more