12-25-2014 03:58 PM
I m having a csv file of contacts which i want to import, but some of the fields are empty in the table and sas is just taking the next values in table not skipping(keeping them empty). Also it shows a warning sign that "Limit sets by ERROR=option reached" and showing the names column empty in the whole table. What to do?
Also how to import only some of the fields from a csv file?
12-26-2014 02:57 PM
Because you tried to read the names into a numeric variable. Names are very unlikely to be able read as a number. If you know that the variable is character you need to define as such. Without any other information SAS will default any variable you reference as numeric.
12-26-2014 03:51 AM
Now as i am writing this code by defining the length of Jname, the program doesn't submit. It just gets stuck there...
infile '/folders/myfolders/Files/................csv' dlm=',' firstobs=2;
Length Jname $ 20;
input Jname HPhone MPhone;
proc print data=p...............s;
12-26-2014 07:24 AM
increase the length of jname variable to 50 - or 60
infile "D:\solution\sample.csv" dsd missover dlm = ',';
input Jname:$50. HPhone:$12. MPhone:$12.;
12-26-2014 07:37 AM
No i am using this code. But instead of any number or name i m getting only a character in most of the fields. isn't ":$15" only for characters while Hphone and Mphone are numbers.
infile '/folders/myfolders/Files/p............s.csv' dsd missover dlm=',' firstobs=2;
input Jname:$50 HPhone:$15 MPhone:$15;
proc print data=p...........s;
12-26-2014 04:29 AM
Try this you can increase the length of th hphone and mphone.
infile "D:\Transaction_data\cust_mast.csv" dsd missover dlm = ',';
input Jname:$20. HPhone:$12. MPhone:$12.;
12-26-2014 09:42 AM
You need to use the DSD option on the INFILE statement to tell SAS to treat consecutive delimiters as meaning there is a missing value. Otherwise it treats them the same as it would multiple spaces in a space delimited list.
data want ;
infile 'sample.csv' dsd truncover firstobs=2;
length Name $40 HomePhone $11 MobilePhone $11 ;
input Name HomePhone MobilePhone ;
Need further help from the community? Please ask a new question.