```Date: Mon, 8 Jun 2009 07:14:48 -0400 Reply-To: Nathaniel.Wooding@DOM.COM Sender: "SAS(r) Discussion" From: Nat Wooding Subject: Re: Identifying the source of an obs from concatenated files Comments: To: Joe Matise In-Reply-To: Content-Type: text/plain; charset="US-ASCII" Joe I am concatenating sets so I would expect the source to be unique. Hence, only one of the In variables will be non-zero and there can be no mistake as to which set a particular obs came from. Nat Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977 Cel Phone: 804-205-0752 Joe Matise To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc Subject Re: Identifying the source of an obs from concatenated files 06/07/2009 08:31 PM Please respond to Joe Matise I would suggest using powers of 2 rather than consecutive integers - otherwise you have problems like 'what does source=6 mean; is it 3,2,1 or 4,2?' so a (in=in1) b (in=in2) c (in=in4) d (in=in8) etc. Effectively identical to the function of the _TYPE_ variable in proc means output datasets. -Joe On Fri, Jun 5, 2009 at 3:47 PM, Nat Wooding wrote: > Let's say that we are concatenating a number of SAS data sets and we need > at some later point to identify the orgin of a observation. Using the In = > option in our set statement, we can write: > > Data New; > set > a (in = in1 ) > b ( in = in2 ) > c ( in = in3 ) ; > source = sum ( in1 , in2*2 , in3*3 ); > > Now, for a given obs, source will take on the value of 1, 2, or 3 . To > fancy this up a bit, we could use a format to display the name of the > actual data set name. Where I use the construct "INn", you may use any > name that suites your fancy. > > Nat Wooding > Environmental Specialist III > Dominion, Environmental Biology > 4111 Castlewood Rd > Richmond, VA 23234 > Phone:804-271-5313, Fax: 804-271-2977 > Cel Phone: 804-205-0752 > > CONFIDENTIALITY NOTICE: This electronic message contains > information which may be legally confidential and or privileged and > does not in any case represent a firm ENERGY COMMODITY bid or offer > relating thereto which binds the sender without an additional > express written confirmation to that effect. The information is > intended solely for the individual or entity named above and access > by anyone else is unauthorized. If you are not the intended > recipient, any disclosure, copying, distribution, or use of the > contents of this information is prohibited and may be unlawful. If > you have received this electronic transmission in error, please > reply immediately to the sender that you have received the message > in error, and delete it. Thank you. > CONFIDENTIALITY NOTICE: This electronic message contains information which may be legally confidential and or privileged and does not in any case represent a firm ENERGY COMMODITY bid or offer relating thereto which binds the sender without an additional express written confirmation to that effect. The information is intended solely for the individual or entity named above and access by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you. ```

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