Hello community,
I have a dataset generated from Transpose (which means the varibale can keep growing depending the data collected) of below:
| Subject | VISALV | HRENDAT | BITR | EXENTIM | PGPERF | LABHHG | SPOWRS | HOIENDAT | AEREL | DTHDAT | VSTIM | LABHHGCS | EXPID |
| 11001 | No Data | Entered | Complete | No Data | Entered | No Data | Entered | Entered | No Data | Reviewed | No Data | Entered | Entered |
| 11002 | No Data | Entered | Entered | Reviewed | Entered | Frozen | Entered | Entered | Entered | Entered | Entered | Complete | Complete |
| 11003 | No Data | Frozen | No Data | No Data | Entered | Reviewed | No Data | Reviewed | No Data | No Data | Reviewed | Entered | |
| 11004 | Entered | Entered | Complete | No Data | Entered | No Data | Reviewed | Entered | Entered | No Data | Frozen | Entered | Entered |
which I want to count the number of enrty in below
| Subject | No Data | Entered | Reviewed | Frozen | Complete | Locked | VISALV | HRENDAT | BITR | EXENTIM | PGPERF | LABHHG | SPOWRS | HOIENDAT | AEREL | DTHDAT | VSTIM | LABHHGCS | EXPID |
| 11001 | 5 | 2 | 1 | 2 | 2 | 1 | No Data | Complete | Complete | No Data | Frozen | No Data | Frozen | Locked | No Data | Reviewed | No Data | Entered | Entered |
| 11002 | 1 | 5 | 2 | 2 | 2 | 1 | No Data | Entered | Frozen | Reviewed | Locked | Frozen | Reviewed | Entered | Entered | Entered | Entered | Complete | Complete |
| 11003 | 3 | 1 | 5 | 3 | 0 | 0 | Frozen | Frozen | Reviewed | No Data | Entered | Reviewed | No Data | Reviewed | Frozen | No Data | Reviewed | Reviewed | |
| 11004 | 2 | 4 | 2 | 3 | 1 | 1 | Entered | Frozen | Complete | Locked | Entered | No Data | Reviewed | Entered | Reviewed | No Data | Frozen | Frozen | Entered |
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.
Don't do the transpose, and then this type of counting is trivial using PROC FREQ
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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.