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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1868 views
  • 0 likes
  • 3 in conversation