Date: Wed, 11 Jun 2008 09:45:37 -0500
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: reading variables enclosed in quotes
In-Reply-To: <5136f27b-0407-4096-b0a9-b7f41a66850c@d45g2000hsc.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
as long as you have at least 2 spaces between each quoted field the &
format modifier is the solution you need.
data x;
infile datalines firstobs=2;
input (name temp state) (&$quote.);
age = input(temp,best.);
drop temp;
datalines;
"Name" "Age" "State"
"Smith AA" "22" "NJ"
"Tom BB" "44" "CT"
"Shake CC" "34" "CA"
;
run;
proc print;
run;
On 6/11/08, rmat <regivm@gmail.com> wrote:
> Hi Mike,
>
> Thanks very much for your solution. However, I am facing another issue
> as there are space within enclosed quotes (like below). It will be
> great if you or anybody else can help me regarding this.
>
> Thanks again, Regi
>
>
> data x;
> infile datalines firstobs=2;
> input (name temp state) (: $quote.);
> age = input(temp,best.);
> drop temp;
> datalines;
> "Name" "Age" "State"
> "Smith AA" "22" "NJ"
> "Tom BB" "44" "CT"
> "Shake CC" "34" "CA"
> ;
> run;
>
|