LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 1997, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 4 Jan 1997 01:24:37 GMT
Reply-To:   Casmrl <casmrl@AOL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Casmrl <casmrl@AOL.COM>
Organization:   AOL http://www.aol.com
Subject:   CHOOSING A SAMPLE WITH CONSTRAINTS

Hi !

I need help with the following situation:

consider the following situation: YEAR = 1, 2 (2 LEVELS) COUNTRY = 1, 2, 3 (3 Levels) PNB = 1, 2, 3, 4 (4 levels) To be more elaborate the following program selects a random sample of size 5 without replacement from the a finite pop. of say 100 obs. The program works well. How could you modify it in a such a way that it will select a certain number of levels for YEAR, (for example 3 levels of 1's and 2 levels of 2's) and for country a certain fixed number of 2's and 3's and probably not the level 1 and so forth. This is almost selecting samples and discarding them untill you obtain the one you want. Could we have looked at each variable as strata and then select from each the required number of levels ? How one would have implemented that idea.

data econ; RETAIN K 10 N 101; DROP N K; INFILE ECONDAT; INPUT IDNUM YEAR COUNTRY PNB ; N = N - 1; IF RANUNI(0) , K/N; K=K-1; PROC PRINT;

An acceptable sample with the requirements specified above could be.

Year country PNB 1 2 3 1 2 3 1 2 4 2 1 4 2 3 1

Any help, suggestion greatly appreciated. Casimir B.


Back to: Top of message | Previous page | Main SAS-L page