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!
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!
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!
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;
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!
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
It worked!!
Thank you s much!!
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!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: