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
- /
- General Programming
- /
- how to automatically get the smaple size n and com...

- 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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-11-2013 06:57 PM

Hi I have this data set

S

1

2

4

3

6

17

I what t0 compute T=1/n * S,

For this it looks easy because n=5 (since there are five observations). But I have many data with varying ‘n’, so I want SAS to count and get the n for each data then compute T=1/n *S;

Accepted Solutions

Solution

07-11-2013
09:56 PM

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

Posted in reply to desireatem

07-11-2013 09:56 PM

There are lots of way to get it. Here is one way.

%let dsid=%sysfunc(open(sashelp.class));

%let nobs=%sysfunc(attrn(&dsid,nlobs));

%let dsid=%sysfunc(close(&dsid));

%put &nobs ;

Ksharp

All Replies

Solution

07-11-2013
09:56 PM

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

Posted in reply to desireatem

07-11-2013 09:56 PM

There are lots of way to get it. Here is one way.

%let dsid=%sysfunc(open(sashelp.class));

%let nobs=%sysfunc(attrn(&dsid,nlobs));

%let dsid=%sysfunc(close(&dsid));

%put &nobs ;

Ksharp