w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to recode variables in SAS?

You are missing the SET statement.

data want;
set have;
myvar=5;
run;

will create a new dataset, want, from have, with the new variable value applied (or the recode or whatever). You could also do

data have;
set have;
myvar=5;
run;

That would replace have with itself plus the recode/whatever. This is actually less common in SAS; it is often preferable to do all recodes in one step, but to create a new dataset (so that the code is reversible easily).





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.