1 The SAS System 10:48 Sunday, July 12, 2009 NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) 9.1 (TS1M3) Licensed to HARVARD UNIV - SCHOOL OF PUBLIC HEALTH - T&R, Site 0001177014. NOTE: This session is executing on the SunOS 5.10 platform. NOTE: SAS 9.1.3 Service Pack 3 ----------------------------------------------------------------------- NBER NOTE: sas now defaults to sas9. sas8 or sas6 will invoke sas version 8 or 6 respectively. - 2005/10/21 ----------------------------------------------------------------------- You are running SAS 9. Some SAS 8 files will be automatically converted by the V9 engine; others are incompatible. Please see http://support.sas.com/rnd/migration/planning/platform/64bit.html PROC MIGRATE will preserve current SAS file attributes and is recommended for converting all your SAS libraries from any SAS 8 release to SAS 9. For details and examples, please see http://support.sas.com/rnd/migration/index.html This message is contained in the SAS news file, and is presented upon initialization. Edit the file "news" in the "misc/base" directory to display site-specific news and information in the program log. The command line option "-nonews" will prevent this display. NOTE: SAS initialization used: real time 2.09 seconds cpu time 0.13 seconds 1 /* Using the SAS FTP function with Taxsim 2 3 */ 4 5 /* Demonstrate SAS Taxsim with a one record dataset. */ 6 7 %MACRO TAXSIM(IN,OUT,MTR=0,idtl=0,plan=0,planval=0); 8 /* 9 10 This macro takes a dataset "IN" (which must include the 22 variables required 11 by Internet Taxsim) and runs it through the Taxsim server at the NBER, returning 12 the results i SAS dataset "OUT". 13 14 1) Need to create a unique filename - &DATAFILE is taken from the time of day 15 &SYSINDEX increments for each macro call. 16 2) Convert any missing values into zeros for taxsim 17 3) upload the values as ASCII 18 4) using the .taxsim file extension on the filename, fetch the results 19 5) fetch the .msg file and print that to the sas log. 20 21 Important References: 22 http://www.nber.org/taxsim/taxsim-calc9/ 23 http://www.nber.org/taxsim/taxsim-ftp.html 2 The SAS System 10:48 Sunday, July 12, 2009 24 http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000178980.htm 25 http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a001281561.htm 26 27 Before reporting communication problems, please add the "debug" option on each of 28 the filename statements, rerun, and send the log file to me. 29 30 Daniel Feenberg 31 feenberg@nber.org 32 617-588-0343 33 */ 34 35 %let DATAFILE = %SUBSTR(&SYSTIME,1,2)%SUBSTR(&SYSTIME,4,2)&SYSINDEX; 36 %PUT 'Filename on taxsimftp server is:' &DATAFILE; 37 38 filename txpydata ftp "&DATAFILE" host='taxsimftp.nber.org' 39 user='taxsim' pass='02138' cd='tmp'; 40 filename results ftp "&DATAFILE..taxsim" host='taxsimftp.nber.org' 41 user='taxsim' pass='02138' cd='tmp'; 42 filename errors ftp "&DATAFILE..msg" host='taxsimftp.nber.org' 43 user='taxsim' pass='02138' cd='tmp'; 44 45 data; 46 set ∈ 47 file txpydata; 48 if _n_ eq 1 then putlog "9 &mtr &idtl &plan &planval /"; 49 if year ne . and mstat ne . and taxsimid ne .; 50 array t %TVARS; 51 do over t ; 52 if t eq . then t = 0; 53 end; 54 put %TVARS; 55 run; 56 57 /* Read and print results directly from taxsimftp server. */ 58 data &OUT; 59 infile results; 60 input taxsimid year state fiitax siitax fica frate srate ficar; 61 run; 62 63 /* Read and print to log the taxsim error message file. */ 64 data; 65 infile errors; 66 input; 67 putlog 'TAXSIM:' _infile_; 68 run; 69 70 71 %MEND TAXSIM; 72 73 %GLOBAL TVARS; 74 %MACRO TVARS; /*List of variables to be sent to Taxsim */ 75 taxsimid year state mstat depx agex pwages swages dividends otherprop 76 pensions gssi transfers rentpaid proptax otheritem childcare ui depchild mortgage 77 ltcg stcg; 78 %MEND; 79 80 *ptions mprint; 81 /* Demonstrate how to get comparison of all states */ 3 The SAS System 10:48 Sunday, July 12, 2009 82 data in; 83 input %TVARS; 84 cards; NOTE: The data set WORK.IN has 1 observations and 22 variables. NOTE: DATA statement used (Total process time): real time 0.07 seconds cpu time 0.04 seconds 86 ; 87 run; 88 %TAXSIM(in,out); 'Filename on taxsimftp server is:' 10482 NOTE: 220 taxsimftp.nber.org FTP server (tnftpd 20080609) ready. NOTE: User taxsim has connected to FTP server on Host taxsimftp.nber.org . NOTE: The file TXPYDATA is: Filename=10482, Pathname= "/tmp" is the current directory, Local Host Name=nber6, Local Host IP addr=66.251.72.76, Service Hostname Name=taxsimftp.nber.org, Service IP addr=66.251.72.173,Service Name=ftp, Service Portno=21,Lrecl=256,Recfm=Variable 9 0 0 0 0 / NOTE: 1 record was written to the file TXPYDATA. The minimum record length was 71. The maximum record length was 71. NOTE: There were 1 observations read from the data set WORK.IN. NOTE: The data set WORK.DATA1 has 1 observations and 22 variables. NOTE: DATA statement used (Total process time): real time 0.13 seconds cpu time 0.02 seconds NOTE: 220 taxsimftp.nber.org FTP server (tnftpd 20080609) ready. NOTE: User taxsim has connected to FTP server on Host taxsimftp.nber.org . NOTE: The infile RESULTS is: Filename=10482.taxsim, Pathname= "/tmp" is the current directory, Local Host Name=nber6, Local Host IP addr=66.251.72.76, Service Hostname Name=taxsimftp.nber.org, Service IP addr=66.251.72.173,Service Name=ftp, Service Portno=21,Lrecl=256,Recfm=Variable NOTE: 51 records were read from the infile RESULTS. The minimum record length was 76. The maximum record length was 76. NOTE: The data set WORK.OUT has 51 observations and 9 variables. NOTE: DATA statement used (Total process time): real time 0.10 seconds cpu time 0.01 seconds 4 The SAS System 10:48 Sunday, July 12, 2009 NOTE: 220 taxsimftp.nber.org FTP server (tnftpd 20080609) ready. NOTE: User taxsim has connected to FTP server on Host taxsimftp.nber.org . NOTE: The infile ERRORS is: Filename=10482.msg, Pathname= "/tmp" is the current directory, Local Host Name=nber6, Local Host IP addr=66.251.72.76, Service Hostname Name=taxsimftp.nber.org, Service IP addr=66.251.72.173,Service Name=ftp, Service Portno=21,Lrecl=256,Recfm=Variable TAXSIM:messages from /bin/webcalc-FreeBSD... NOTE: 1 record was read from the infile ERRORS. The minimum record length was 37. The maximum record length was 37. NOTE: The data set WORK.DATA2 has 1 observations and 0 variables. NOTE: DATA statement used (Total process time): real time 0.10 seconds cpu time 0.01 seconds 89 proc print; 90 91 /* Demonstrate printing of error message (Year out of range for state id) */ NOTE: No variables in data set WORK.DATA2. NOTE: PROCEDURE PRINT used (Total process time): real time 0.09 seconds cpu time 0.04 seconds 92 data in; 93 input %TVARS; 94 cards; NOTE: The data set WORK.IN has 1 observations and 22 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 96 ; 97 run; 98 %TAXSIM(in,out); 'Filename on taxsimftp server is:' 10486 NOTE: 220 taxsimftp.nber.org FTP server (tnftpd 20080609) ready. NOTE: User taxsim has connected to FTP server on Host taxsimftp.nber.org . NOTE: The file TXPYDATA is: Filename=10486, Pathname= "/tmp" is the current directory, Local Host Name=nber6, Local Host IP addr=66.251.72.76, Service Hostname Name=taxsimftp.nber.org, Service IP addr=66.251.72.173,Service Name=ftp, Service Portno=21,Lrecl=256,Recfm=Variable 5 The SAS System 10:48 Sunday, July 12, 2009 9 0 0 0 0 / NOTE: 1 record was written to the file TXPYDATA. The minimum record length was 71. The maximum record length was 71. NOTE: There were 1 observations read from the data set WORK.IN. NOTE: The data set WORK.DATA3 has 1 observations and 22 variables. NOTE: DATA statement used (Total process time): real time 0.09 seconds cpu time 0.01 seconds NOTE: 220 taxsimftp.nber.org FTP server (tnftpd 20080609) ready. NOTE: User taxsim has connected to FTP server on Host taxsimftp.nber.org . NOTE: The infile RESULTS is: Filename=10486.taxsim, Pathname= "/tmp" is the current directory, Local Host Name=nber6, Local Host IP addr=66.251.72.76, Service Hostname Name=taxsimftp.nber.org, Service IP addr=66.251.72.173,Service Name=ftp, Service Portno=21,Lrecl=256,Recfm=Variable NOTE: 0 records were read from the infile RESULTS. NOTE: The data set WORK.OUT has 0 observations and 9 variables. NOTE: DATA statement used (Total process time): real time 0.09 seconds cpu time 0.02 seconds NOTE: 220 taxsimftp.nber.org FTP server (tnftpd 20080609) ready. NOTE: User taxsim has connected to FTP server on Host taxsimftp.nber.org . NOTE: The infile ERRORS is: Filename=10486.msg, Pathname= "/tmp" is the current directory, Local Host Name=nber6, Local Host IP addr=66.251.72.76, Service Hostname Name=taxsimftp.nber.org, Service IP addr=66.251.72.173,Service Name=ftp, Service Portno=21,Lrecl=256,Recfm=Variable TAXSIM:messages from /bin/webcalc-FreeBSD... TAXSIM:STOP 1 TAXSIM: State tax calculator available 1977 - 2008 only TAXSIM: Record ID : 1. TAXSIM: Logical Record Number : 1 TAXSIM: Law Year : 1960. TAXSIM: State id : -1. TAXSIM: Data record, as converted : 1. 1960. -1. 2. 1. 0. 1300000. 0. 0. 0. 0. 0. 0. 0. 12000. 0. 0. 0. 1. 44780. -17700. -12300. TAXSIM: Abandoning processing NOTE: 9 records were read from the infile ERRORS. The minimum record length was 6. The maximum record length was 124. NOTE: The data set WORK.DATA4 has 9 observations and 0 variables. NOTE: DATA statement used (Total process time): real time 0.09 seconds cpu time 0.00 seconds 6 The SAS System 10:48 Sunday, July 12, 2009 99 100 NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 3.24 seconds cpu time 0.31 seconds