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 (July 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 17 Jul 2006 21:05:55 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Lookup table in SAS + random numbers in SAS

On Sat, 15 Jul 2006 03:31:32 -0400, Heman Hunters <hemanhunters@GMAIL.COM> wrote:

>G'day mates! > >Today I have two questions:

Then you really should have posted twice, so that there would be sparate threads.

> >1) I have a large dataset, containing people's social security numbers and >their income. No I want to select e.g. two percent of the people in the >table AT RANDOM, and change their income by 10 percent. How do I >accomplish this?

PROC SURVEYSELECT was recommended (and by someone other than David! :-) ). That's probably the best choice, but you may not have it available.

Somebody suggested the venerable K/N algorithm. That's good if you must control precisely the size of the sample so that you get not one more nor one less observation than you specify.

If approximately two percent is good enough, it can be as simple as:

data subset; set large; where ranuni(1)<0.02; [your code] run;

> > >2) Depending on what income, and the social status (married, divorced, >etc.) the people above have, I want to give them a certain score. I have >(on paper) a list of which income interval and social status goes with >which score. Now I want to take the income variable in the table in 1), >compare with my "lookup table", and assign the apropriate score to evey >person. How do I do this the best way? Do I use a lot of IF:s? Or can I >create a table containing income intervals, social status and the >corresponding score, and look up values in some clever way? > >Thanks lots!


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