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

Accepted Solution Solved
Reply
Super Contributor
Posts: 297
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: 9,676

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

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: 9,676

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

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.

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

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