DATA Step, Macro, Functions and more

Data from one dataset based on number of observations

Reply
Frequent Contributor
Posts: 77

Data from one dataset based on number of observations

Hello all,

I have a dataset wherein I have 1 lakh records based on data I need 300 samples of each based on one variable for example :

I have dataset which has data for India,Singapore,Malaysia

So I need 100 for India 100 for Singapore and 100 for Malaysia in one dataset . I cannot use where condition because I have more than 300 conditions for which I need 100 data in one dataset.

Any suggestion would really appreciate.

PROC Star
Posts: 1,215

Re: Data from one dataset based on number of observations

Posted in reply to india2016

Do you need 300 samples or 1 sample of 300 observations?

PROC Star
Posts: 1,215

Re: Data from one dataset based on number of observations

Posted in reply to india2016

Show us some sample of your data, makes it much easier to help you.

Frequent Contributor
Posts: 103

Re: Data from one dataset based on number of observations

Posted in reply to india2016

It sounds like you want simple random sampling by strata. The following SESUG paper describes this well (example 2 on page 7):

 

https://www.lexjansen.com/sesug/2015/190_Final_PDF.pdf

 

Norman.
SAS 9.4 (TS1M4) X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation

Ask a Question
Discussion stats
  • 3 replies
  • 171 views
  • 1 like
  • 3 in conversation