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?