Date: Fri, 11 Jul 2008 15:08:19 -0400
Reply-To: SUBSCRIBE SAS-L Chandra Gadde <ddraj2015@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: SUBSCRIBE SAS-L Chandra Gadde <ddraj2015@GMAIL.COM>
Subject: Re: Creating SAS datasets from reading a file
Nat,
Thanks for the quick response. I could hard code those states.
Unfortunately, we definitely need to take the input from a file which is
subjected to change. That way, our users would like to have control on the
file. We don't want to change the SAS code whenever there is a change in
the input file that contains group of states. We definitely need to use
that file.
On Fri, 11 Jul 2008 15:05:43 -0400, Nat Wooding <Nathaniel.Wooding@DOM.COM>
wrote:
>Interesting -- this is around the third time today that this question has
>come up. You could use the approach
>
>Data dwproject_NY
> dwproject_md etc ;
>
>infile ...
>input ...;
>
>if state ='NY' then output dwproject_NY; else
>if state ='MD' then output dwproject_Md; else you need one of these for
>each state.
>
>run;
>
>And, I must ask, why do you want a separate file for each state?
>
>
>Nat Wooding
>Environmental Specialist III
>Dominion, Environmental Biology
>4111 Castlewood Rd
>Richmond, VA 23234
>Phone:804-271-5313, Fax: 804-271-2977
>
>
>
> SUBSCRIBE SAS-L
> Chandra Gadde
> <ddraj2015@GMAIL. To
> COM> SAS-L@LISTSERV.UGA.EDU
> Sent by: "SAS(r) cc
> Discussion"
> <SAS-L@LISTSERV.U Subject
> GA.EDU> Creating SAS datasets from reading
> a file
>
> 07/11/2008 02:57
> PM
>
>
> Please respond to
> SUBSCRIBE SAS-L
> Chandra Gadde
> <ddraj2015@GMAIL.
> COM>
>
>
>
>
>
>
>Hi All
>
> I need your help in creting SAS datasets based on sates in a file.
>I need to create sas dataset for each state that is saved in a file. I have
>a file called stlist.del is saved in the following path.
>
>C:\dwproject\stlist.del
>
>and the stlist.del file contains the following states.
>NY
>MD
>NJ
>CA
>VA
>PA
>
>Now I need to create SAS dataset for each state from a given flat file.
>
>%macro st_code;
>
>Data dwproject_&st.;
>infile "c:\dwproject\inputfile.del"
>input ----
>----
>---
>;
>where state=&st.;
>run;
>%mend;
>%st_code(); ---->This is wherey I need to get the st values from the above
>mentioned file.
>
>The output from the above step should be a set of sas datasets for each
>state.
>
>dwproject_NY;
>dwproject_MD;
>dwproject_NJ;
>dwproject_CA;
>dwproject_VA;
>dwproject_PA;
>
>
>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.
|