turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Shorten length of variable/count observations per ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-21-2010 09:28 PM

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?

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-22-2010 03:43 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-22-2010 11:44 AM

I tried proq sql count(). it worked. thanks!!