HI Siva,
Try this
option obs=10;
proc import datafile='C:\shiva\not.csv'
out=work.mydata
dbms=csv
replace;
datarow=5;
getnames=yes;
run;
After the execution of the above code reset the option by
option obs=max;
thank you for responding, without using global option we cannot read part of the data form the csv file, and we cannot use range statement inside the proc import step WHY ?
at last my question is why Range statement is not working in the CSV importing file
shiva
Because a CSV has a flat file structure, and does not have sheets and cells. An Excel workbook has this information included in it's "metadata".
Do you really need to use proc import?
I typically use Datasteps to import delimited files. I created a sample CSV which contains 4 variables and imported only 3 of them using the ffollowing:
DATA WORK.TEST;
LENGTH
STUFF1 $ 6
STUFF3 $ 5
STUFF4 $ 9 ;
FORMAT
STUFF1 $CHAR6.
STUFF3 $CHAR5.
STUFF4 $CHAR9. ;
INFORMAT
STUFF1 $CHAR6.
STUFF3 $CHAR5.
STUFF4 $CHAR9. ;
INFILE 'E:\BOOK1.CSV'
FIRSTOBS=2
LRECL=29
ENCODING="WLATIN1"
TERMSTR=CRLF
DLM=","
MISSOVER
DSD ;
INPUT
STUFF1 : $CHAR6.
STUFF3 : $CHAR5.
STUFF4 : $CHAR9. ;
RUN;
Is this useful?
Regards,
Scott
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.