BookmarkSubscribeRSS Feed
DJChavda
Obsidian | Level 7

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;

shivakrishna
Fluorite | Level 6

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

LinusH
Tourmaline | Level 20

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".

Data never sleeps
Scott_Mitchell
Quartz | Level 8

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

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 18 replies
  • 11870 views
  • 6 likes
  • 10 in conversation