- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have run the following code in order to import a .csv file of data (published by Statistics Canada) into a SAS dataset:
DATA WORK.Firm_count_Dec_2015;
format Ref_Date $7. GEO $12. 'Geographical Classification'n $2. SIZE $2. Description $24. Vector $9. Coordinate $8. Value 6.;
infile "c:\user\homareau\PredictiveModels\FirmCounts\Firm_count_Dec_2015.csv" firstobs=2 dlm=',' Missover DSD;
informat Ref_Date $7. GEO $12. 'Geographical Classification'n $2. SIZE $2. Description $24. Vector $9. Coordinate $8. Value 6.;
input Ref_Date $7. GEO $12. 'Geographical Classification'n $2. SIZE Description Vector Coordinate Value;
label Ref_Date = 'Date'
GEO = 'Prov_Name'
'Geographical Classification'n = 'Prov_Code'
SIZE = 'Firm_Size'
Description = 'NAICS_Description'
Vector = 'CANSIM_V_Code'
Coordinate = 'Coordinate'
Value = 'Count';
drop Vector Coordinate;
run;
However the data from the .csv file are not importing properly. The attachment shows the end result. It has to do with the delimiter but I thought my code was correct. What am I missing?
Thanks...
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Using Formatted Input with a delimited file is not compatable and will not give correct result.
input Ref_Date $7. GEO $12. 'Geographical Classification'n $2. SIZE Description Vector Coordinate Value;
Remove those INFORMAT specifications from the INPUT statement.
Delimited files use LIST input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please describe what is "wrong". Also, at least on my monitor you screen capture is too fuzzy to read.
It may help to post some lines of raw data and print results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Figured it out. Thanks...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please share your solution so that anyone that finds this thead from a search has a solution to go with the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Using Formatted Input with a delimited file is not compatable and will not give correct result.
input Ref_Date $7. GEO $12. 'Geographical Classification'n $2. SIZE Description Vector Coordinate Value;
Remove those INFORMAT specifications from the INPUT statement.
Delimited files use LIST input.