Help using Base SAS procedures

Defining dummy variables in SAS

Reply
N/A
Posts: 0

Defining dummy variables in SAS

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,
Super User
Posts: 9,662

Re: Defining dummy variables in SAS

Your code looks good.



Ksharp
N/A
Posts: 0

Re: Defining dummy variables in SAS

Thanks for your response!
Contributor sss
Contributor
Posts: 65

Re: Defining dummy variables in SAS

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;
Ask a Question
Discussion stats
  • 3 replies
  • 348 views
  • 0 likes
  • 3 in conversation