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 (May 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 26 May 2006 00:49:39 -0500
Reply-To:     Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Subject:      Re: Comparing multiple arrays and writing out results based
              onvalue of the var names.
Comments: To: Shelley EXT-Baxter <Shelley.Baxter@boeing.com>
Content-Type: text/plain; charset=US-ASCII

Shelley:

There are two cells that I think are incorrectly coded. They are in cells E20 and E38. I simply deleted the 7th observations from the temp1 dataset since there is no matching for the value "EAC segment can't" from three TEIS variables. Let me know if you think my execution is not what you requested.

data temp1; length TextEidTAemOk TextEidTAetOk TextEidTMfrMiss TextEidTMfrOk $ 30; input TextEidTAemOk & TextEidTAetOk & TextEidTMfrMiss & TextEidTMfrOk &; datalines; . . . Eid_Mfr is not valid . Eid_Aet is not valid . . Eid_Aem is not valid Eid_Aet is not valid . . Eid_Aem is not valid Eid_Aet is not valid . . Eid_Aem is not valid Eid_Aet is not valid . Eid_Mfr is not valid Eid_Aem is not valid Eid_Aet is not valid . . ; run;

data Result(keep=TEIS TextEidTAemOk TextEidTAetOk TextEidTMfrMiss TextEidTMfrOk); length c1-c4 $ 30; length TEIS $ 10; array a[3] $ 7 _temporary_ ("EID_MFR" "EID_AEM" "EID_AET"); array b[4] $ 30 TextEidTAemOk TextEidTAetOk TextEidTMfrMiss TextEidTMfrOk; array c[4] c1-c4; array Match[4] Match1-Match4; set temp(rename=(TextEidTAemOk=c1 TextEidTAetOk=c2 TextEidTMfrMiss=c3 TextEidTMfrOk=c4)); do i=1 to dim(a); TEIS=a[i]; do j=1 to dim(c); Match[j]=0; end; do j=1 to dim(c); if upcase(substr(c[j],1,7))=a[i] then Match[j]=1; else Match[j]=0; end; total=0; do j=1 to dim(c); total=total+Match[j]; end; if total eq 0 then do; do j=1 to dim(b); b[j]=" "; end; output; end; else do; do j=1 to dim(b); if Match[j] eq 1 then b[j]=c[j]; else b[j]=" "; end; output; end; end; run;

proc print data=Result; run;

***** OUTPUT ***** The SAS System 09:27 Thursday, May 25, 2006 3324

TextEid Obs TEIS TextEidTAemOk TextEidTAetOk TMfrMiss TextEidTMfrOk

1 EID_MFR Eid_Mfr is not valid 2 EID_AEM 3 EID_AET 4 EID_MFR 5 EID_AEM 6 EID_AET Eid_Aet is not valid 7 EID_MFR 8 EID_AEM Eid_Aem is not valid 9 EID_AET Eid_Aet is not valid 10 EID_MFR 11 EID_AEM Eid_Aem is not valid 12 EID_AET Eid_Aet is not valid 13 EID_MFR Eid_Mfr is not valid 14 EID_AEM Eid_Aem is not valid 15 EID_AET Eid_Aet is not valid 16 EID_MFR 17 EID_AEM Eid_Aem is not valid 18 EID_AET Eid_Aet is not valid

J S Huang 1-515-557-3987 fax 1-515-557-2422

>>> "EXT-Baxter, Shelley" <Shelley.Baxter@boeing.com> 05/25/06 10:11 AM >>> Thanks Jiann-Shiun for your interest. I tried to reduce my problem to that of comparing only (the NAME OF)one element of an array at a time to the NAME OF each of the elements of a second array and then writing out all of the one elements VALUE as well as the VALUE of the matched-name element of the second array. (I have also numeric arrays to do this also)

I actually worked hard at developing that grid and hoped it would come through more clearly than it did. I am sending the xls version color coded.

I'm sure Paul Dorfman could figure out a hash table but I really need to get a better grip on array processing and do loops. I was trying to generalize your insightful solution to my "Array Processing Multiple Comparisons across columns and rows".

DEFINING AND THEN DESCRIBING THE PROBLEM seems to be at least half the battle! Please let me know if this helps clarification for you.

Regards, Shelley

-----Original Message----- From: Jiann-Shiun Huang [mailto:Jiann-Shiun.Huang@amerus.com] Sent: Wednesday, May 24, 2006 7:56 PM To: EXT-Baxter, Shelley Subject: Re: Comparing multiple arrays and writing out results based onvalue of the var names.

Shelley:

Probably it is due to the format of the text, it is pretty hard to read the contents following your description. Is it possible that you can send as a text file attachment with email? Also what is the content of the dataset actemp.engval12? Is it possible that you can rephrase your question in terms of dataset? An example of what you have and what you like to have will help.

Thanks,

J S Huang 1-515-557-3987 fax 1-515-557-2422

>>> "EXT-Baxter, Shelley" <Shelley.Baxter@BOEING.COM> 05/24/06 8:22 PM >>> This is what I want:

I want to read in two sets of variables, and write all of the second set as values for one variable. I am trying to have a correspondance between the Names of elements in one array with the names in the second. This is not a transpose problem. I need to generalize for unknown names of vars and existence of vars. I need to later deal with the numeric Teis arrays, but one problem at a time. I have been digging through Ted Clay's Looping Macros (Array and Do_Over) but I think my problem is more basic.

TEXT ARRAY TEIS ARRAY TextEidTAemOk TextEidTAetOk TextEidTMfrMiss TextEidTMfrOk EID_MFR EID_AEM EID_AET 1 Eid_Mfr is not valid 81205 PW4056

CFM56 2 Eid_Aet is not valid 81205 PW4056

PW4444 3 Eid_Aem is not valid Eid_Aet is not valid

81205 PW4056 RB211 4 Eid_Aem is not valid Eid_Aet is not valid

81205 PW4056 RB211 5 Eid_Aem is not valid Eid_Aet is not valid Eid_Mfr is not valid 81205 PW4056 RB211 6 Eid_Aem is not valid Eid_Aet is not valid

81205 PW4056 CFM56 7 EAC segment can't 81205

CFM56

TEIS TextEidTAemOk TextEidTAetOk TextEidTMfrMiss TextEidTMfrOk 1 EID_MFR Eid_Mfr is not valid Eid_Mfr is not valid 2 EID_AEM 3 EID_AET 4 AID_MFR 5 EID_AEM 6 EID_AET Eid_Aet is not valid 7 EID_MFR 8 EID_AEM Eid_Aem is not valid 9 EID_AET Eid_Aet is not valid 10 EID_MFR 11 EID_AEM Eid_Aem is not valid 12 EID_AET Eid_Aet is not valid 13 EID_MFR Eid_Mfr is not valid 14 EID_AEM Eid_Aem is not valid 15 EID_AET Eid_Aet is not valid 16 EID_MFR 17 EID_AEM Eid_Aem is not valid 18 EID_AET Eid_Aet is not valid 19 EID_MFR EAC segment can't 20 EID_AEM 21 EID_AET

This is one try. It doesn't work; I use the vname function but I am stymied in how to output the second array with values.

data CharTeis; set actemp.engval12; keep TeisChar; array CharTeis {*} &AllCharTeis ; array CharText{*} &TextTei; length TeisChar TextChar $20 ; do i =1 to dim(CharTeis); call vname(CharTeis(i),TeisChar); output; do j=1 to dim(CharText); call vname(CharText(j),TextChar); output; end; end; if substr(TeisChar,5,3)=substr(TextChar,9,3) then output; run;

Thanks for any help.

Shelley S. Baxter, Ph.D. > EXT-Programmer / Analyst > Airplane Reliability & Maintainability Systems Boeing Corp. > Tel: 425-234-2296 509-637-4500 > Loc.: 10.16.4 4H1-1.7 > >


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