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 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 11 May 2010 11:56:20 -0500
Reply-To:     Joe Matise <snoopy369@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Matise <snoopy369@GMAIL.COM>
Subject:      Re: Import when only first comma is delimiter
Comments: To: Sterling Paramore <gnilrets@gmail.com>
In-Reply-To:  <AANLkTin3WsNS1cnQvITen9UIq1pglUXh5SvBPZXjbGey@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Lots of ways to work around that. One way is to convert the first comma into a non-comma and then delimit it with this new character.

data test; infile datalines dlm='|'; format label $100.; input @; _t = find(_infile_,','); put _t=; substr(_infile_,_t,1)='|'; input start label $; datalines; 314,Other circulatory system diagnoses w MCC 315,Other circulatory system diagnoses w CC 316,Other circulatory system diagnoses w/o CC/MCC 326,Stomach, esophageal & duodenal proc w MCC 327,Stomach, esophageal & duodenal proc w CC 328,Stomach, esophageal & duodenal proc w/o CC/MCC ;;;; run;

Make sure | doesn't appear in your data of course, or pick some other character [perhaps a goofy nonprinting character or something].

-Joe On Tue, May 11, 2010 at 11:45 AM, Sterling Paramore <gnilrets@gmail.com>wrote:

> Dear SAS-L, > > I'm trying to import a file where only the first column in a row is a > delimiter, but can't quite seem to get the import working correctly. > Here's > an example of some rows that are causing problems: > > 314,Other circulatory system diagnoses w MCC > 315,Other circulatory system diagnoses w CC > 316,Other circulatory system diagnoses w/o CC/MCC > 326,Stomach, esophageal & duodenal proc w MCC > 327,Stomach, esophageal & duodenal proc w CC > 328,Stomach, esophageal & duodenal proc w/o CC/MCC > > I tried: > > data MSDRG3_v26; > infile "/sas/DataStore/SAS_ETL/Supplemental_Xwalks/RawFiles/msdrg3.v26" > lrecl=2000; > > input START $ 1-3 > @5 LABEL $80.; > ; > run; > > but since there's a carriage return after each line, I get output that > looks > like this: > > 314 315,Other circulatory system diagnoses w CC > 316 326,Stomach, esophageal & duodenal proc w MCC > 327 328,Stomach, esophageal & duodenal proc w/o CC/MCC > > > Any ideas? > > Thanks, > Sterling >


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