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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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