this is the log. Thanks 1 The SAS System 14:16 Wednesday, January 29, 2020 1 ;*';*";*/;quit;run; 2 OPTIONS PAGENO=MIN; 3 %LET _CLIENTTASKLABEL='3_Distanza_tempo.sas'; 4 %LET _CLIENTPROCESSFLOWNAME='Standalone Not In Project'; 5 %LET _CLIENTPROJECTPATH=''; 6 %LET _CLIENTPROJECTPATHHOST=''; 7 %LET _CLIENTPROJECTNAME=''; 8 %LET _SASPROGRAMFILE='X:\ISTAT\LINEE_DI_ATTIVITA_2019\Aree interne\prg\distanza\3_Distanza_tempo.sas'; 9 %LET _SASPROGRAMFILEHOST='ROSSI'; 10 11 ODS _ALL_ CLOSE; 12 OPTIONS DEV=SVG; 13 GOPTIONS XPIXELS=0 YPIXELS=0; 14 %macro HTML5AccessibleGraphSupported; 15 %if %_SAS_VERCOMP(9, 4, 4) >= 0 %then ACCESSIBLE_GRAPH; 16 %mend; 17 FILENAME EGHTML TEMP; 18 ODS HTML5(ID=EGHTML) FILE=EGHTML 19 OPTIONS(BITMAP_MODE='INLINE') 20 %HTML5AccessibleGraphSupported 21 ENCODING='utf-8' 22 STYLE=HtmlBlue 23 NOGTITLE 24 NOGFOOTNOTE 25 GPATH=&sasworklocation 26 ; NOTE: Writing HTML5(EGHTML) Body file: EGHTML 27 28 %let ll1=%str(42.691560,-73.827840); 29 %let key = AIzaSyAhnuS_QMZlitN9RwRhRT7IbaT4vq8T5P0; 30 31 * 32 create a data set with locations specified in latitude and longitude 33 a random sample of 5 observations from SASHELP.ZIPCODE 34 use SEED=0 to get a new sample each time program is run 35 ; 36 37 proc surveyselect data=sashelp.zipcode (keep=zip city statecode x y) 38 out=lat_long sampsize=5 seed=0; 39 run; NOTE: The data set WORK.LAT_LONG has 5 observations and 5 variables. NOTE: PROCEDURE SURVEYSELECT ha utilizzato (tempo totale di elaborazione): real time 0.08 seconds cpu time 0.09 seconds 40 41 * 42 place number of zip in a macro variable 43 in this example you know it is 5 44 but you might not know in another use of the SAS code 45 ; 46 data _null_; 47 call symputx('nlls',obs); 48 stop; 2 The SAS System 14:16 Wednesday, January 29, 2020 49 set lat_long nobs=obs; 50 run; NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds 51 52 * create a macro that contains a loop to access Google Maps multiple time; 53 %macro distance_time; 54 55 * delete any data set named DISTANCE_TIME that might exist in the WORK library; 56 proc datasets lib=work nolist; 57 delete distance_time; 58 quit; 59 60 %do j=1 %to &nlls; 61 data _null_; 62 nrec = &j; 63 set lat_long point=nrec; 64 call symputx('ll2',catx(',',y,x)); 65 stop; 66 run; 67 68 * lat/long of centroid of zip 12203 hard-coded as part of the URL; 69 filename x url "https://www.google.com/maps/api/directions/json?origin=&ll1&destination=&ll2&key=&Key"; 70 filename z temp; 71 72 * same technique used in the example with a pair of lat/long coodinates; 73 data _null_; 74 infile x recfm=f lrecl=1 end=eof; 75 file z recfm=f lrecl=1; 76 input @1 x $char1.; 77 put @1 x $char1.; 78 if eof; 79 call symputx('filesize',_n_); 80 run; 81 82 * drive time as a numeric variable; 83 data temp; 84 infile z recfm=f lrecl=&filesize. eof=done; 85 input @ 'miles' +(-15) @ '"' distance :comma12. text $30.; 86 units = scan(text,1,'"'); 87 text = scan(text,3,'"'); 88 * convert times to seconds; 89 select; 90 * combine days and hours; 91 when (find(text,'d') ne 0) time = sum(86400*input(scan(text,1,' '),best.), 92 3600*input(scan(text,3,' '),best.)); 93 * combine hours and minutes; 94 when (find(text,'h') ne 0) time = sum(3600*input(scan(text,1,' '),best.), 95 60*input(scan(text,3,' '),best.)); 96 * just minutes; 97 otherwise time = 60*input(scan(text,1,' '),best.); 98 end; 99 output; 100 keep distance time; 3 The SAS System 14:16 Wednesday, January 29, 2020 101 stop; 102 done: 103 output; 104 run; 105 106 filename x clear; 107 filename z clear; 108 109 * add an observation to the data set DISTANCE_TIME; 110 proc append base=distance_time data=temp; 111 run; 112 %end; 113 %mend; 114 115 * use the macro; 116 %distance_time; NOTE: Deleting WORK.DISTANCE_TIME (memtype=DATA). NOTE: PROCEDURE DATASETS ha utilizzato (tempo totale di elaborazione): real time 0.02 seconds cpu time 0.00 seconds NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. NOTE: The infile X is: Filename=https://www.google.com/maps/api/directions/json?origin=42.691560,-73.827840&destination=33.338834,-87.122617AIzaSyAhn uS_QMZlitN9RwRhRT7IbaT4vq8T5P0=AIzaSyAhnuS_QMZlitN9RwRhRT7IbaT4vq8T5P0, Local Host Name=Rossi, Local Host IP addr=fe80::10d0:1421:f87:de32%13, Service Hostname Name=lhr25s09-in-f164.1e100.net, Service IP addr=216.58.208.164, Service Name=N/A,Service Portno=443,Lrecl=1, Recfm=Fixed NOTE: The file Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00035, RECFM=F,LRECL=1,Dimensione (byte)=0, Ultima modifica=29 gennaio 2020 14:22:22, Create Time=29 gennaio 2020 14:22:22 NOTE: 236 records were read from the infile X. NOTE: 236 records were written to the file Z. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.27 seconds cpu time 0.00 seconds 4 The SAS System 14:16 Wednesday, January 29, 2020 NOTE: The infile Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00035, RECFM=F,LRECL=236,Dimensione (byte)=236, Ultima modifica=29 gennaio 2020 14:22:22, Create Time=29 gennaio 2020 14:22:22 NOTE: 1 record was read from the infile Z. NOTE: SAS went to a new line when INPUT @'CHARACTER_STRING' scanned past the end of a line. NOTE: The data set WORK.TEMP has 1 observations and 2 variables. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.01 seconds cpu time 0.00 seconds NOTE: Fileref X has been deassigned. NOTE: Fileref Z has been deassigned. NOTE: Appending WORK.TEMP a WORK.DISTANCE_TIME. NOTE: BASE data set does not exist. DATA file is being copied to BASE file. NOTE: There were 1 observations read from the data set WORK.TEMP. NOTE: The data set WORK.DISTANCE_TIME has 1 observations and 2 variables. NOTE: PROCEDURE APPEND ha utilizzato (tempo totale di elaborazione): real time 0.01 seconds cpu time 0.00 seconds NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. NOTE: The infile X is: Filename=https://www.google.com/maps/api/directions/json?origin=42.691560,-73.827840&destination=37.130336,-85.689134AIzaSyAhn uS_QMZlitN9RwRhRT7IbaT4vq8T5P0=AIzaSyAhnuS_QMZlitN9RwRhRT7IbaT4vq8T5P0, Local Host Name=Rossi, Local Host IP addr=fe80::10d0:1421:f87:de32%13, Service Hostname Name=lhr25s09-in-f164.1e100.net, Service IP addr=216.58.208.164, Service Name=N/A,Service Portno=443,Lrecl=1, Recfm=Fixed NOTE: The file Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00036, RECFM=F,LRECL=1,Dimensione (byte)=0, Ultima modifica=29 gennaio 2020 14:22:23, Create Time=29 gennaio 2020 14:22:23 5 The SAS System 14:16 Wednesday, January 29, 2020 NOTE: 236 records were read from the infile X. NOTE: 236 records were written to the file Z. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.27 seconds cpu time 0.04 seconds NOTE: The infile Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00036, RECFM=F,LRECL=236,Dimensione (byte)=236, Ultima modifica=29 gennaio 2020 14:22:23, Create Time=29 gennaio 2020 14:22:23 NOTE: 1 record was read from the infile Z. NOTE: SAS went to a new line when INPUT @'CHARACTER_STRING' scanned past the end of a line. NOTE: The data set WORK.TEMP has 1 observations and 2 variables. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.01 seconds cpu time 0.01 seconds NOTE: Fileref X has been deassigned. NOTE: Fileref Z has been deassigned. NOTE: Appending WORK.TEMP a WORK.DISTANCE_TIME. NOTE: There were 1 observations read from the data set WORK.TEMP. NOTE: 1 observations added. NOTE: The data set WORK.DISTANCE_TIME has 2 observations and 2 variables. NOTE: PROCEDURE APPEND ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. NOTE: The infile X is: Filename=https://www.google.com/maps/api/directions/json?origin=42.691560,-73.827840&destination=36.896936,-95.924587AIzaSyAhn uS_QMZlitN9RwRhRT7IbaT4vq8T5P0=AIzaSyAhnuS_QMZlitN9RwRhRT7IbaT4vq8T5P0, Local Host Name=Rossi, Local Host IP addr=fe80::10d0:1421:f87:de32%13, Service Hostname Name=lhr25s09-in-f164.1e100.net, Service IP addr=216.58.208.164, Service Name=N/A,Service Portno=443,Lrecl=1, Recfm=Fixed 6 The SAS System 14:16 Wednesday, January 29, 2020 NOTE: The file Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00037, RECFM=F,LRECL=1,Dimensione (byte)=0, Ultima modifica=29 gennaio 2020 14:22:23, Create Time=29 gennaio 2020 14:22:23 NOTE: 236 records were read from the infile X. NOTE: 236 records were written to the file Z. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.29 seconds cpu time 0.01 seconds NOTE: The infile Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00037, RECFM=F,LRECL=236,Dimensione (byte)=236, Ultima modifica=29 gennaio 2020 14:22:23, Create Time=29 gennaio 2020 14:22:23 NOTE: 1 record was read from the infile Z. NOTE: SAS went to a new line when INPUT @'CHARACTER_STRING' scanned past the end of a line. NOTE: The data set WORK.TEMP has 1 observations and 2 variables. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.01 seconds cpu time 0.01 seconds NOTE: Fileref X has been deassigned. NOTE: Fileref Z has been deassigned. NOTE: Appending WORK.TEMP a WORK.DISTANCE_TIME. NOTE: There were 1 observations read from the data set WORK.TEMP. NOTE: 1 observations added. NOTE: The data set WORK.DISTANCE_TIME has 3 observations and 2 variables. NOTE: PROCEDURE APPEND ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. NOTE: The infile X is: Filename=https://www.google.com/maps/api/directions/json?origin=42.691560,-73.827840&destination=34.14464,-118.250262AIzaSyAhn uS_QMZlitN9RwRhRT7IbaT4vq8T5P0=AIzaSyAhnuS_QMZlitN9RwRhRT7IbaT4vq8T5P0, 7 The SAS System 14:16 Wednesday, January 29, 2020 Local Host Name=Rossi, Local Host IP addr=fe80::10d0:1421:f87:de32%13, Service Hostname Name=lhr25s09-in-f164.1e100.net, Service IP addr=216.58.208.164, Service Name=N/A,Service Portno=443,Lrecl=1, Recfm=Fixed NOTE: The file Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00038, RECFM=F,LRECL=1,Dimensione (byte)=0, Ultima modifica=29 gennaio 2020 14:22:24, Create Time=29 gennaio 2020 14:22:24 NOTE: 236 records were read from the infile X. NOTE: 236 records were written to the file Z. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.39 seconds cpu time 0.04 seconds NOTE: The infile Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00038, RECFM=F,LRECL=236,Dimensione (byte)=236, Ultima modifica=29 gennaio 2020 14:22:24, Create Time=29 gennaio 2020 14:22:24 NOTE: 1 record was read from the infile Z. NOTE: SAS went to a new line when INPUT @'CHARACTER_STRING' scanned past the end of a line. NOTE: The data set WORK.TEMP has 1 observations and 2 variables. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.01 seconds cpu time 0.00 seconds NOTE: Fileref X has been deassigned. NOTE: Fileref Z has been deassigned. NOTE: Appending WORK.TEMP a WORK.DISTANCE_TIME. NOTE: There were 1 observations read from the data set WORK.TEMP. NOTE: 1 observations added. NOTE: The data set WORK.DISTANCE_TIME has 4 observations and 2 variables. NOTE: PROCEDURE APPEND ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.01 seconds WARNING: Apparent symbolic reference DESTINATION not resolved. 8 The SAS System 14:16 Wednesday, January 29, 2020 WARNING: Apparent symbolic reference DESTINATION not resolved. WARNING: Apparent symbolic reference DESTINATION not resolved. NOTE: The infile X is: Filename=https://www.google.com/maps/api/directions/json?origin=42.691560,-73.827840&destination=40.212752,-123.842699AIzaSyAh nuS_QMZlitN9RwRhRT7IbaT4vq8T5P0=AIzaSyAhnuS_QMZlitN9RwRhRT7IbaT4vq8T5P0, Local Host Name=Rossi, Local Host IP addr=fe80::10d0:1421:f87:de32%13, Service Hostname Name=lhr25s09-in-f164.1e100.net, Service IP addr=216.58.208.164, Service Name=N/A,Service Portno=443,Lrecl=1, Recfm=Fixed NOTE: The file Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00039, RECFM=F,LRECL=1,Dimensione (byte)=0, Ultima modifica=29 gennaio 2020 14:22:24, Create Time=29 gennaio 2020 14:22:24 NOTE: 236 records were read from the infile X. NOTE: 236 records were written to the file Z. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.29 seconds cpu time 0.00 seconds NOTE: The infile Z is: Nome file=C:\Users\A.Rossi\AppData\Roaming\SAS\EnterpriseGuide\EGTEMP\SEG-9324-7be0aa8a\contents\SAS Temporary Files\_TD6628_ROSSI_\#LN00039, RECFM=F,LRECL=236,Dimensione (byte)=236, Ultima modifica=29 gennaio 2020 14:22:24, Create Time=29 gennaio 2020 14:22:24 NOTE: 1 record was read from the infile Z. NOTE: SAS went to a new line when INPUT @'CHARACTER_STRING' scanned past the end of a line. NOTE: The data set WORK.TEMP has 1 observations and 2 variables. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.01 seconds cpu time 0.01 seconds NOTE: Fileref X has been deassigned. NOTE: Fileref Z has been deassigned. NOTE: Appending WORK.TEMP a WORK.DISTANCE_TIME. NOTE: There were 1 observations read from the data set WORK.TEMP. NOTE: 1 observations added. NOTE: The data set WORK.DISTANCE_TIME has 5 observations and 2 variables. NOTE: PROCEDURE APPEND ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.01 seconds 9 The SAS System 14:16 Wednesday, January 29, 2020 117 118 * 119 add variables from original data set to new data set distance_time 120 use geodist function to calculate straight line distance 121 ; 122 data distance_time; 123 set distance_time; 124 set lat_long point=_n_; 125 straight_line = round(geodist(&ll1,-73.827840,y,x,'DM'), 0.01); _______ 72 ERROR 72-185: The GEODIST function call has too many arguments. 126 run; NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 125:49 NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.DISTANCE_TIME may be incomplete. When this step was stopped there were 0 observations and 8 variables. WARNING: Data set WORK.DISTANCE_TIME was not replaced because il passo è stato interrotto. NOTE: DATA statement ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds 127 128 proc print data=distance_time noobs label; 129 var x y time distance straight_line zip city statecode; ERROR: Variable X not found. ERROR: Variable Y not found. ERROR: Variable STRAIGHT_LINE not found. ERROR: Variable ZIP not found. ERROR: Variable CITY not found. ERROR: Variable STATECODE not found. 130 format zip z5. time time6. ; 131 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE PRINT ha utilizzato (tempo totale di elaborazione): real time 0.00 seconds cpu time 0.00 seconds 132 133 134 135 %LET _CLIENTTASKLABEL=; 136 %LET _CLIENTPROCESSFLOWNAME=; 137 %LET _CLIENTPROJECTPATH=; 138 %LET _CLIENTPROJECTPATHHOST=; 139 %LET _CLIENTPROJECTNAME=; 140 %LET _SASPROGRAMFILE=; 141 %LET _SASPROGRAMFILEHOST=; 142 143 ;*';*";*/;quit;run; 144 ODS _ALL_ CLOSE; 145 146 147 QUIT; RUN; 10 The SAS System 14:16 Wednesday, January 29, 2020 148
... View more