Date: Sat, 6 Jun 2009 04:29:12 -0700
Reply-To: Melodyp <pearsonmelody@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Melodyp <pearsonmelody@GMAIL.COM>
Organization: http://groups.google.com
Subject: How to read CSV file with Percentage into SAS
Content-Type: text/plain; charset=ISO-8859-1
I have a data set it looks like:
COST AVG_COST MARGIN AVG_MARGIN PER_MARGIN
3565.00 155.00 178.25 7.75 4.76%
483.00 483.00 24.15 4.15 4.76%
I am having difficulty to read the percentage into SAS, I used the
following code to read:
====================================================
data mylib.A002;
infile A001 DLM=',' DSD LRECL=5000 missover FIRSTOBS=2;
length Cost 6 Avg_cost 6 Margin 6 avg_margin 6 ;
informat per_margin percent.;
input Cost Avg_cost Margin Avg_margin per_margin ;
run;
=====================================================
All other fields are read in, but the per_margin (percentage line)
keeps giving me error :
Invalid data.
This .csv file was not originally in this format, it was saved in csv
format in Excel.
Can someone help me to see what's the problem?
Thanks
Melody