10-24-2017 12:49 AM
Perhaps this can help?
"Example 2: Reading Character Data That Contains Embedded Blanks"
10-24-2017 09:25 AM
Your data are totally messed up. data test; infile datalines ; input ; p=find(_infile_,','); product=substr(_infile_,1,p-1); _infile_=substr(_infile_,p+1); p=find(_infile_,'$'); sale=input(substr(_infile_,1,p),comma32.); _infile_=substr(_infile_,p+1); ratio=input(_infile_,comma32.); drop p; datalines; Boot,29,761$,3.61 Men's Casual,67,242$,3.5 Sport Shoe,1,690$,3.48 ; run;
10-24-2017 01:14 PM
10-24-2017 04:29 PM
So your source data is not formatted properly for anything. You cannot use comma as the delimiter and also have comma in the values. If your values contain the delimiter character then they need to be in quotes. Like this:
Boot,"29,761$",3.61 Men's Casual,"67,242$",3.5 Sport Shoe,"1,690$",3.48
But the presence of the $ after the value does present a method that might make it possible to read the data.
data fixed; infile datalines dlm=',' dsd truncover column=cc; length Product $20 Sale 8 ExchangeRate 8; input product @ ; start=cc ; input @'$' @ ; sale=input(substrn(_infile_,start,cc-start-1),comma32.); input @cc+1 ExchangeRate ; drop start; datalines; Boot,29,761$,3.61 Men's Casual,67,242$,3.5 Sport Shoe,1,690$,3.48 ;