- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have a total leisure time physical activity (MVPA) as a continues variable. I am trying to create a new MVPA variable that is in tertiles.
So far this is what I have done
proc rank data = recode5;
ranks groups = 3;
var mvpa;
ranks mvpa_tert;
run;
But this code is not working....
Any help and guidance is greatly appreciated!
Thank you!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You didn't specify an output data set in the PROC RANKS statement so the data created is probably called DATA1 or something.
check your log.
@epi101 wrote:
Hi all,
Thank you for the advice. The code seems to run. The log is not producing any errors. However when I tried to run cross tabulations is saying that mvpa_tert (my new categorical variable) not found.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc rank data = recode5 groups = 3;
var mvpa;
ranks mvpa_tert;
run;
I think you have a semicolon too early.
@epi101 wrote:
Hi all,
I have a total leisure time physical activity (MVPA) as a continues variable. I am trying to create a new MVPA variable that is in tertiles.
So far this is what I have done
proc rank data = recode5;
ranks groups = 3;
var mvpa;
ranks mvpa_tert;
run;
But this code is not working....
Any help and guidance is greatly appreciated!
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Doesn't work is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
proc rank data = recode5; ranks groups = 3; var mvpa; ranks mvpa_tert; run;
Groups is an option that goes on the Proc Rank statement, not as you have it her
Try
proc rank data = recode5 groups = 3 ; var mvpa; ranks mvpa_tert; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Thank you for the advice. The code seems to run. The log is not producing any errors. However when I tried to run cross tabulations is saying that mvpa_tert (my new categorical variable) not found.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You likely didn't run it on the new file created. SAS will automatically supply a name for the file if you don't.
Try:
proc rank data = recode5 out=want groups = 3; var mvpa; ranks mvpa_tert; run;
and then do your analyst on file want
Art, CEO, AnalystFinder.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It worked!!
Thank you s much!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You didn't specify an output data set in the PROC RANKS statement so the data created is probably called DATA1 or something.
check your log.
@epi101 wrote:
Hi all,
Thank you for the advice. The code seems to run. The log is not producing any errors. However when I tried to run cross tabulations is saying that mvpa_tert (my new categorical variable) not found.
Thank you!