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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 714 views
  • 1 like
  • 2 in conversation