BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
zimcom
Pyrite | Level 9

Hello community,

 

I have a dataset generated from Transpose (which means the varibale can keep growing depending the data collected) of below:

SubjectVISALVHRENDATBITREXENTIMPGPERFLABHHGSPOWRSHOIENDATAERELDTHDATVSTIMLABHHGCSEXPID
11001No DataEnteredCompleteNo DataEnteredNo DataEnteredEnteredNo DataReviewedNo DataEnteredEntered
11002No DataEnteredEnteredReviewedEnteredFrozenEnteredEnteredEnteredEnteredEnteredCompleteComplete
11003No DataFrozenNo DataNo DataEnteredReviewedNo DataReviewed No DataNo DataReviewedEntered
11004EnteredEnteredCompleteNo DataEnteredNo DataReviewedEnteredEnteredNo DataFrozenEnteredEntered

 

which I want to count the number of enrty in below 

SubjectNo DataEnteredReviewedFrozenCompleteLockedVISALVHRENDATBITREXENTIMPGPERFLABHHGSPOWRSHOIENDATAERELDTHDATVSTIMLABHHGCSEXPID
11001521221No DataCompleteCompleteNo DataFrozenNo DataFrozenLockedNo DataReviewedNo DataEnteredEntered
11002152221No DataEnteredFrozenReviewedLockedFrozenReviewedEnteredEnteredEnteredEnteredCompleteComplete
11003315300FrozenFrozenReviewedNo DataEnteredReviewedNo DataReviewed FrozenNo DataReviewedReviewed
11004242311EnteredFrozenCompleteLockedEnteredNo DataReviewedEnteredReviewedNo DataFrozenFrozenEntered
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

It depends on your logic. I'm assuming right now that your output doesn't actually align with the data. If it's supposed to, can you please explain why Entered =2 when the first row has 6 values of Entered?

I would recommend doing a PROC FREQ on the untransposed data set and then merging the results with your transposed data set. 

 

You could try it after but it's harder since the number of columns will change. You'll also need to account for new words manually, whereas FREQ will be dynamic regardless of data changes.

 

 

 

 

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Don't do the transpose, and then this type of counting is trivial using PROC FREQ

--
Paige Miller
zimcom
Pyrite | Level 9

@PaigeMiller @Reeza 

Thank you both for pointing out the direction!

really appreciated!

Reeza
Super User

It depends on your logic. I'm assuming right now that your output doesn't actually align with the data. If it's supposed to, can you please explain why Entered =2 when the first row has 6 values of Entered?

I would recommend doing a PROC FREQ on the untransposed data set and then merging the results with your transposed data set. 

 

You could try it after but it's harder since the number of columns will change. You'll also need to account for new words manually, whereas FREQ will be dynamic regardless of data changes.

 

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1154 views
  • 4 likes
  • 3 in conversation