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 (April 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 24 Apr 2007 17:22:17 -0400
Reply-To:     "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Organization: Internet News Service
Subject:      Re: help with macro processing & dataset creation
Comments: To: sas-l@uga.edu

theorbo wrote: > Hi. I posted a question last week and am grateful for the help. My > question today is a development from the previous question. > > I have two datasets: > 1) <perm.list> is a table with each observation consisting of a name > and associated IDs > 2) <to_match_on> is a table with lots of observations that contain > variables with text information and variables with IDs. > > My program goes through the <to_match_on> file and outputs the > observations where there is a match between an ID in the <perm.list> > and <to_match_on> file. Ultimately I am creating separate sheets in an > excel workbook to show the matches for each <perm.list> ID. The > <perm.list> name associated with the <perm.list> ID is how I name the > separate sheets in the workbook. > > I am having trouble creating a dataset to show the <perm.list> name > variables that result in no matches from the <to_match_on> file. I've > tried using IF-THEN/ELSE to output to my <dbo.missing> dataset but am > getting every observation that doesn't match rather than just what I > think is the "&name" that I want displayed. I also tried using PUT but > that hasn't worked, either. > > Any ideas would be appreciated ...

I have a feeling you don't need macro at all.

I'll take the liberty of stating what I hope is an equivalent problem in big brotherland.

A population of 500,000 people has about 500 bad apples operating in a series of gangs containing no more than 35 members.

50,000 surveillance images where taken during the course of a sporting event enjoyed by 80,000 attendees. Each image captured upto 300 individuals who were identified by facial recognition processing.

Premise: Not normal data, where gang data is: gangid personid1-personid35 and surveil data is: imageid personid1-personid300

Q: Members from which gangs are seen in the images ?

Important aspects are transposition of lookup data so it can be easily placed in a hash used for lookup. ------------------------------------------------ data gangs; do gangid = 1 by 1; array members personid1-personid35; do i = 1 to dim(members) until (i>5 and 100*ranuni(1234) > 90); count + 1; members[i] = ceil(5e5*ranuni(1234)); end; do i = i to dim(members); members[i] = .; end; output; if count > 501 then stop; end; drop i count; run;

data surveillance; do imageid = 1 to 5e4; array p personid1-personid300; do i = 1 to dim(p) until (i>20 and 100*ranuni(1234) > 99); p[i] = floor(8e4 * ranuni(1234)); end; do i = i to dim(p); p[i] = .; end; output; end; drop i; run;

proc transpose data=gangs out=vector(drop=_name_ rename=col1=personId where=(personId)); by gangid; var personid1-personid35; run;

data gfinds; call missing (personId, gangId); declare hash g (dataset:'vector'); g.defineKey ('personId'); g.defineData ('gangId'); g.defineDone ();

do until (end); set surveillance end=end; array p personid1-personid300; tag = 0; do pindex = 1 to dim(p); personId = p[pindex]; if g.find() = 0 then do; tag + 1; output; end; end; end;

keep imageid personid gangid pindex tag;

stop; run;

proc tabulate data=gfinds; class tag imageid; var gangid; table imageid,tag*gangid*min*f=best12.; run;

-- Richard A. DeVenezia http://www.devenezia.com/


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