10-04-2011 04:32 PM
hello i am a graduate student and I have no SAS experience and our biostatistics professor has just thrown us into the programming and we have to clean the data. Her How to clean the data worksheet is hard to understand and everything that i type in comes up with an error statement and just does not work. If there is an easy and understandable way to clean data it would be much appreciated. I need help as soon as possible if there is anyone out there that could reply and help it would be so helpful.
10-04-2011 05:33 PM
You have to provide more info in order for anyone to help. Are you on a PC or, more specifically, how do you access SAS. Where is the table located (surely your prof had to tell you something)? Does your table have a name?
10-04-2011 05:59 PM
If she's provided you with a how to clean worksheet she hasn't left you entirely in the dark...
You could post some more info, that spreadsheet for starters, what you've tried also helps.
Here's some quick tutorials on SAS that might be worth learning.
SAS does have a learning curve, but that's life!
10-04-2011 07:04 PM
ive attached the help sheet and followed a lot of these instructions but literally have gotten no where with error msgs such as : Error 180-322 Statement is not valid or it is used out of proper order. this is what i enter:
if 0 < ridagemn ,= 468 then ridagemn= 'young';
else 469 < ridagemn <= 648 then RIDAGEMN= 'middle';
else 649 < RIDAGEMN <= 1080 then RIDAGEMN= 'old'
RIDAGEMN is my variable name. is that even right?
the only things that ive been able to get right is entering and naming my library, setting data, proc print, and proc freq
I'm currently looking at the sites from reeza
10-04-2011 07:14 PM
I doubt that anyone on the forum will do homework for you, but we definitely can provide some direction.
I sounds like you are trying to accomplish a datastep. Did you start and end it with something like:
/* this is a comment .. I presume your statement went here. If not, this is where they should have been */
Now, without even considering if what you tried makes sense, using the above structure it really should have looked like:
if 0 < ridagemn <= 468 then ridagemn= 'young';
else if 469 <= ridagemn <= 648 then RIDAGEMN= 'middle';
else if 649 <= RIDAGEMN <= 1080 then RIDAGEMN= 'old';
10-04-2011 07:20 PM
Looks like you're trying to recode a variable.
First off, you'll need to store the recoded variable in a new variable so you can't set the ridagemn to young/middle/old.
You're also mixing types (numbers/characters) but ignore that for now.
Second you may have some syntax errors or they're from copying and pasting not sure.
Third you need an else if not just and else statement.
the following should work:
if 0 < ridagemn <= 468 then ridagemn_cat= 'young';
else if 469 < ridagemn <= 648 then RIDAGEMN_cat= 'middle';
else if 649 < RIDAGEMN <= 1080 then RIDAGEMN_cat= 'old'
To check it run a proc freq on your data.
proc freq data=clean_data;
If the variable is continuous you want to check what happens at the boundaries (specifically at 648, 649 and 648.5).