Hey Guys, I am very new to this SAS coding stuff. I just have one simple question. I have a variable that has 5 different categories, 0,1,2,3,4. However, for my ANOVA analysis I need the variable to only consist of 1,2,3,4. How would I go about editing my variable to get rid of the 0 and create a new variable with categories 1, 2, 3, 4?
Thanks
Do I understand correctly - you are talking about one variable that can hold one of 5 values 0-4 ?
And you want to run the ANOVA procedure neglecting those observation wit value=0 ?
If this is the case use next syntax:
Proc anova data=<data set name>
(where=(<variable name> ne 0)) ...
Do I understand correctly - you are talking about one variable that can hold one of 5 values 0-4 ?
And you want to run the ANOVA procedure neglecting those observation wit value=0 ?
If this is the case use next syntax:
Proc anova data=<data set name>
(where=(<variable name> ne 0)) ...
@kjvander wrote:
Hey Guys, I am very new to this SAS coding stuff. I just have one simple question. I have a variable that has 5 different categories, 0,1,2,3,4. However, for my ANOVA analysis I need the variable to only consist of 1,2,3,4. How would I go about editing my variable to get rid of the 0 and create a new variable with categories 1, 2, 3, 4?
Thanks
If the 0 value actually represents something like "not answered" "not collected" "unavailable" you might be better off setting the value to the SAS missing value. That way the 0 doesn't get used for almost any purpose unless specifically requested.
The missing values excluded from numerical calculations. The mean of 0, 1, 2, 3, 4 would be 2. If you set the 0 to missing then you would have a mean of 2.5.
The concept of missing is fairly important in many places. Do you want the value included in the "n" of any statistic such as mean, standard deviation or even min and max? If the answer to that is "no" then missing is likely what you want.
The modeling procedures will not use any record with missing values for the variables in the model statement generally, so no additional code would have been needed.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.