| Date: | Fri, 22 Aug 2008 09:40:26 -0400 |
| Reply-To: | Jack Clark <jclark@HILLTOP.UMBC.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jack Clark <jclark@HILLTOP.UMBC.EDU> |
| Subject: | Re: generate a string |
|
| In-Reply-To: | A<6716d5d0808220622w594a35c2p2dccddc129f279bb@mail.gmail.com> |
| Content-Type: | text/plain; charset="us-ascii" |
Jeff,
Use the concatenation operator (||) to build the string.
data _null_;
file 'c:\temptest\sastest.txt';
input ssn $;
newvar = "Insert into #temp values('"||trim(ssn)||"');";
put newvar;
cards;
123456789
234567891
345678912
;
run;
Jack Clark
Research Analyst
phone: 410-455-6256
fax: 410-455-6850
jclark@hilltop.umbc.edu
University of Maryland, Baltimore County
Sondheim Hall, 3rd Floor
1000 Hilltop Circle
Baltimore, MD 21250
Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you.-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Jeff
Sent: Friday, August 22, 2008 9:23 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: generate a string
144 data _null_;
145 set &client.MkSeg;
146 file "N:\PM1\MarketSegmentAug04\BCBSAL\mk.txt";
147 if ssn not eq '';
148 put "Insert into #temp values('" trim(ssn) "');";
-----
79
76
ERROR 79-322: Expecting a (.
ERROR 76-322: Syntax error, statement will be ignored.
149 run;
I want to generate a string like
Insert into #temp values('422804663' );
Insert into #temp values('416159268' );
Insert into #temp values('424060217' );
Insert into #temp values('448505012' );
How can I fix this problem?
THX.
Jeff
|