BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jsaldain33
Calcite | Level 5

SAS provides .cpt files with zipcode county information http://support.sas.com/rnd/datavisualization/mapsonline/html/misc.html. How can I extract from these files a .csv or .txt file that has zipcode and county columns?

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@jsaldain33 wrote:

SAS provides .cpt files with zipcode county information http://support.sas.com/rnd/datavisualization/mapsonline/html/misc.html. How can I extract from these files a .csv or .txt file that has zipcode and county columns?


You use proc cimport to import this transport file to a SAS dataset, and then a data step to export the data to the desired text format.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

@jsaldain33 wrote:

SAS provides .cpt files with zipcode county information http://support.sas.com/rnd/datavisualization/mapsonline/html/misc.html. How can I extract from these files a .csv or .txt file that has zipcode and county columns?


You use proc cimport to import this transport file to a SAS dataset, and then a data step to export the data to the desired text format.

jsaldain33
Calcite | Level 5

Thanks. I managed to do it:

 

libname sasfiles 'C:\Users\Joaquin\Desktop';
filename intrans 'C:\Users\Joaquin\Desktop\zipcode_q1_2005.cpt' ;
proc cimport infile=intrans library=sasfiles;
run;

proc export data=sasfiles.zipcode_q1_2005
    outfile='C:\Users\Joaquin\Desktop\zipcode_q1_2005.csv'
    dbms=csv
    replace;
run;

 

Any suggestions to execute this block of code for each file in a directory?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 535 views
  • 1 like
  • 2 in conversation