Previous Page | Next Page

The IMPORT Procedure

Example 4: Importing a Comma-Delimited File with a CSV Extension


Procedure features:

The IMPORT procedure statement arguments:

DATAFILE=

DBMS=

OUT=

REPLACE

Data source statements:

GETNAMES=

Other features: PRINT procedure

This example imports the following comma-delimited file and creates a temporary SAS data set named WORK.SHOES. GETNAME= is set to 'no', so the variable names in record 1 are not used. DATAROW=2 begins reading data from record 2.

"Africa","Boot","Addis Ababa","12","$29,761","$191,821","$769"
"Asia","Boot","Bangkok","1","$1,996","$9,576","$80"
"Canada","Boot","Calgary","8","$17,720","$63,280","$472"
"Central America/Caribbean","Boot","Kingston","33","$102,372","$393,376","$4,454"
"Eastern Europe","Boot","Budapest","22","$74,102","$317,515","$3,341"
"Middle East","Boot","Al-Khobar","10","$15,062","$44,658","$765"
"Pacific","Boot","Auckland","12","$20,141","$97,919","$962"
"South America","Boot","Bogota","19","$15,312","$35,805","$1,229"
"United States","Boot","Chicago","16","$82,483","$305,061","$3,735"
"Western Europe","Boot","Copenhagen","2","$1,663","$4,657","$129"


Program

proc import datafile="C:\temp\test.csv"
     out=shoes
     dbms=csv
     replace;
     getnames=no;
run;

proc print;
run;

Previous Page | Next Page | Top of Page