how to automatically get the smaple size n and compute 1/n *X

Accepted Solution Solved
Reply
Super Contributor
Posts: 303
Accepted Solution

how to automatically get the smaple size n and compute 1/n *X

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
Super User
Posts: 10,046

Re: how to automatically get the smaple size n and compute 1/n *X

Posted in reply to desireatem

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

View solution in original post


All Replies
Solution
‎07-11-2013 09:56 PM
Super User
Posts: 10,046

Re: how to automatically get the smaple size n and compute 1/n *X

Posted in reply to desireatem

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 139 views
  • 0 likes
  • 2 in conversation