It would depend quite a bit on what your current data looks like.
If you have an actual date value for each day of exercise then assigning a format like Monyy. to the date variable and using proc freq would count the days.
Dummy code as no data provided:
Proc Freq data=have; tables participantid*date /list; format date monyy7. ; run;
If you want a dataset the add the out=datasetname option to the tables statement after the / .
I used list above as a two-way table for this type of data might get pretty ugly and List output is pretty simple to follow.
If you have more than on observation per date then you really need to provide an example of how your data looks.
@cjpink07 wrote:
Thanks. Just working with BRFSS data. I couldn’t remember how to code for a frequency data for number of good health days by race and sex.
Last time I checked the question response was in days not good EXCEPT for the Don't Know and Refused which were 77 and 99. The 88 meant no days of bad/poor mental or physical health. So you need to change the 88 to 0 and set the 77 and 99 to missing before any calculations.
The tricky part is if you are looking for just Physical Health or Mental Health, as those are two topics that some combine to get a single Healthy Days. At which point you may want to look at the documentation for your data set and see if there is a CDC added variable that has the value you want.
One of the approaches was to use the average physical and mental days not good after setting the don't know and refused to missing and the conversion of 88 to 0. Then subtract that from 30 if you want days not poor/bad.
Another approach would be to subtract the max of the physical/mental days bad from 30 to get "good" days. After you have the new variable with the count you want then it should be easy.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.