Help using Base SAS procedures

Shorten length of variable/count observations per participant

Reply
N/A
Posts: 0

Shorten length of variable/count observations per participant

I have three data sets. Each one of them is very lengthy! So I need help in finding shortcuts on how to process the data sets.

1) I noticed that the length of some variables is unreasonably long so how do I shorten the length of those variables? I tried doing this, but it didn't work for me:
DATA A;
LENGTH MTOTAL $ 8;
SET TOT.TOTAL1;
RUN;

2) Each data set have countless participants that made visits. Each participant is supposed to have 32 observations per visit. How do I make sure there are exactly 32 observations per participant at each visit? I did PROC REPORT for each data set and tried counting 32 observations for each participant but that proved to be time consuming. What's the shortcut to do this?
Super User
Posts: 5,438

Re: Shorten length of variable/count observations per participant

Posted in reply to deleted_user
1) What do you mean that this doesn't work? I got a clean $8 char for MTOTAL in the A table.

2) Depends on how you want the output, and what time consuming means.
One way is to use SQL, with COUNT(), GROUP BY and HAVING to filter out visits with less than 32 observations.

/Linus
Data never sleeps
N/A
Posts: 0

Re: Shorten length of variable/count observations per participant

Posted in reply to deleted_user
I tried proq sql count(). it worked. thanks!!
Ask a Question
Discussion stats
  • 2 replies
  • 318 views
  • 0 likes
  • 2 in conversation