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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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