05-22-2013 02:10 PM
I have the following code to read a csv:
retain id videoname views minutes segment50 segment75 segment100;
length videoname $ 255;
infile 'C:\Documents and Settings\gautrj1\Desktop\report\brightcovevideo.csv'
DSD FIRSTOBS=2 LRECL=10000 termstr=crlf;
input id videoname views minutes segment50 percent4. segment75 percent4. segment100 percent4. ;
format id bestd14.;
the last column of the csv is a percentage and i have the informat set, but the data read into sas does not match up (ie. 37% in row 1 below is 2254 in SAS. I'm thinking that SAS goe to the end of the line and looks for a comma, but don't know how to account for that in SAS. Any ideas? Thanks, John
|ID||Video Name||Views||Viewed Minutes||Percentage to 50% Mark||Percentage to 75% Mark||Percentage of Complete Views|
|2254686068001||Access and Permissions-LFD Advisor Registration||597||1863||56%||52%||41%|
|2020247472001||Lincoln FinancialÂ® Presents an Annuity Story||546||3651||59%||53%||41%|
05-22-2013 03:45 PM
It's probably that your informat is PERCENT4, but there are only 3 characters in 37%. Try adding TRUNCOVER to the end of the INFILE statement.
05-22-2013 04:02 PM
DSD and formatted input (as you have written in your input statement) are incompatible. Use the colon modified to get proper result