BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I've created dummy categories (outside of SAS) for a single variable. I now need to "define" these categories in SAS and create a new data set that contains them. My thoughts are to create a new format using a PROC FORMAT and VALUE statement, then use a PROC FREQ, TABLES, and FORMAT statement save to a file.

I'm extremely extremely new to SAS and data mining as a whole but based on past assignments would think the two commands would look something like this (values in quotes are what I established as dummy variables):

PROC FORMAT library=library;

VALUE vage

LOW – 17 = ‘0001’
18-19 = ’0010’
20-21=’0100’;

Run;
.........

PROC FREQ data=save.train;
TABLES vage;
FORMAT vage vage.;

Run;

Any assistance would be greatly appreciated.

Regards,
3 REPLIES 3
Ksharp
Super User
Your code looks good.



Ksharp
deleted_user
Not applicable
Thanks for your response!
sss
Fluorite | Level 6 sss
Fluorite | Level 6
Hi...

As per you post your code is correct and if you want to create new dataset and want to apply the formatting on them use the code

data new_dataset;
set save.train;
format vage vage.;
run;

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!

What is Bayesian Analysis?

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.

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
  • 3 replies
  • 1294 views
  • 0 likes
  • 3 in conversation