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

I am currently working on a research project where the data has been stored in an Access database. I converted the Access database into an Excel spreadsheet, as SAS 9.4 cannot read in Access files. However, from time to time, SAS cannot find the Excel file using the pathway I provided. Here is the error: 

 

402 proc import out=one
403 datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
404 DBMS=xlsx replace;
405 getnames=yes;
406 run;

ERROR: Physical file does not exist, C:\Users\jackz\Desktop\SAS\BBFE.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

 

Does anyone know why this error is occuring? Also, why is SAS reading it as C:\Users\jackz\Desktop\SAS\BBFE instead of 'C:\Users\jackz\Desktop\SAS\BBFE.xlsx'? The pathway is definitely  'C:\Users\jackz\Desktop\SAS\BBFE.xlsx', as it has worked from time to time. Here is my entire code for context: 

 

 

proc format;
	value sexf              			1 = 'Female'
				      			2 = 'Male' 
				     	 			;
	value occf              			1 = 'Doctor'
				      			2 = 'Medical student'
				            		3 = 'Nurse midwife'
				            		4 = 'Lab technician'
				            		5 = 'Mortuary attendant'
				            		6 = 'Clinical officer'
				            		7 = 'Nurse'
				            		8 = 'Nursing student'
				            		9 = 'Housekeeper'
				           			10 = 'Other'
				           			11 = 'Dentist'
				           			. = 'Missing'
				           			;
	value ptcaref          				1= 'Always'
				           			2= 'Often' 
				           			3= 'Rarely'
				           			4= 'Never' 
				           			;
	value shiftf           				1='Day shift'
	                       				2='Evening/night shift'
3='Mixed shift (sometimes day, sometimes evening/night)'
				           			;
	value specialtyf       				1= 'Internal Medicine'
				           			2= 'Pediatrics'
				           			3= 'Anesthesiology' 
				           			4= 'Pathology'
				           			5= 'Surgery'
				           			6= 'Obstetrics/Gynecology' 
				           			7= 'Radiology'
				           			8= 'Other'
				           			;
	value deptf            				1 = 'Medical Ward'
				           			2 = 'Pediatric Ward' 
				           			3 = 'Operating Theatre' 
				           			4 = 'Dental Clinic' 
				           			5 = 'Surgical Ward' 
				           			6 = 'Ob/Gyn Ward' 
				           			7 = 'Emergency Ward'
                           				8 = 'Dialysis clinic' 
				           			9 = 'Other'
                          				10 = 'Intensive care unit'
                          				11= 'Oncology Ward'
                          				97= 'Not applicable (I work 
in many locations)'
				          			;	 
	value locf 		      			1 = 'Inpatient'
			   	          			2 = 'Outpatient'
			   	          			. = 'Missing'
			   	          			;
	value prickf          				0 = 'No'
		  		          			1 = 'Yes'
				          			;
	value sharpsf         				0 = 'No'
				          			1= 'Yes'
				          			;	
	value sharpsyrf        				0 = 'No'
				          			1= 'Yes'
				          			;
	value injrecapf       				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injwastef       				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injsutf         				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injdrawf        				0 = 'No'
				          			1 = 'Yes'
			              			;
	value injivf          				0 = 'No'
				          			1 = 'Yes'
				          			;
    value injsugarf       				0 = 'No'
			              			1 = 'Yes'
			              			;
	value injvaccf        				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injorf          				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injsurgf        				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injcleanf       				0 = 'No'
				          			1 = 'Yes'
			              			;
	value injsetf 	      			1 = 'Hospital ward'
				          			2 = 'Operating theatre'
				          			3 = 'Emergency/casualty ward'
				          			4 = 'Outpatient clinic'
				          			5 = 'Laundry'
				          			6 = 'Other'
				          			7 = 'Mortuary'
				          			8 = 'Hospital grounds'
				          			;
    value splashf       				0 = 'No'
			              			1 = 'Yes'
				          			;
    value splashyrf     				0 = 'No'
			              			1 = 'Yes'
				          			;
    value splashoccurf  	 			1 = 'Hospital ward'
				          			2 = 'Operating theatre'
				          			3 = 'Emergency/casualty ward'
				          			4 = 'Outpatient clinic'
				          			5 = 'Laundry'
								6 = 'Other'
                          				;
	value worryf        				1 = 'Worried'
				          			2 = 'Not worried'
				          			99 = 'Not applicable' 
				          			;
    value washsoapf      				0 = 'No'
			              			1 = 'Yes'
                          				;
    value washiodalcf   				0 = 'No'
			              			1 = 'Yes'
                          				;
    value squeezef     					0 = 'No'
			             			1 = 'Yes'
                         				;
  	value pressuref           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value alertf              			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhivf            			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhepbf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhepcf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value prophf              			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value tetanusf            			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthepbf        			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthepcf        			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value responsenaf         			0 = 'No'
			              			1 = 'Yes'
                          				;
value alertnof            			1 = 'Did not think it was 
important to my health'
2 = 'Did not know how to report the exposure'
				          			3 = 'Did not have time'
4 = 'Worried that I would seem unprofessional or careless' 
5 = 'Felt reporting would not change outcome'
				          			6 = 'No reporting system 
available'
				          			7 = 'Other'
8 = 'Patient HIV nonreactive'	
								;
  	value alerttimef          			1 = 'Less than 2 hours'
				          			2 = 'Less than 24 hours' 
				          			3 = 'Less than 72 hours'
				          			4 = 'Less than one week' 
				          			5 = 'Over one week'
				          			6 = 'Other'
				          			97 = 'Not applicable'
								;
  	value alertpersonf        			1 = 'Less than 2 hours'
				          			2 = 'Less than 24 hours' 
				          			3 = 'Less than 72 hours' 
				          			4 = 'Less than one week' 
				          			5 = 'Over one week'
				          			6 = 'Other'
				          			97 = 'Not applicable'
								;
  	value prophtxf      				0 = 'No'
			              			1 = 'Yes'
				          			;
  	value prophtnegf          			0 = 'No'
				          			1 = 'Yes'
				          			;
  	value prophptnohivf 				0 = 'No'
				          			1 = 'Yes'
				          			;
  	value prophlowriskf 				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophneedf    				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophsideefff  				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophhivfearf 				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophmedsf    				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophoutf     				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophnaf      				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hivf          				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hepbf         				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hepcf         				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value needlerecapf  				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value glovesdrawf   				1 = 'Always'
				  				2 = 'Sometimes'
  								3 = 'Rarely'
  								4 = 'Never'
  								97 = 'Not applicable'
  								;
  	value glovesneedlef 				1 = 'Always'
				  				2 = 'Sometimes'
  								3 = 'Rarely'
  								4 = 'Never'
  								97 = 'Not applicable'
  								;
  	value gloveproceduresf 				1 = 'Always'
				     				2 = 'Sometimes'
     								3 = 'Rarely'
     								4 = 'Never'
     								97 = 'Not applicable'
     								;
  	value glovedisposalf  				1 = 'Always'
				    				2 = 'Sometimes'
    								3 = 'Rarely'
    								4 = 'Never'
    								97 = 'Not applicable'
    								;
  	value noglovesnotimef    			0 = 'No'
			             			1 = 'Yes'
				       			;
  	value noglovesemergf    			0 = 'No'
				      			1 = 'Yes'
				      			;
  	value noglovesunavailf  			0 = 'No'
								1 = 'Yes'
								;
  	value noglovescomfortf  			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesdifff     			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesnecf      			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesothf      			0 = 'No'
								1 = 'Yes'
								;
  	value protectivef       			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Never'
								; 
  	value washhandsf        			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Never'
								; 
  	value needlereusef      			0= 'No'
				      			1= 'Yes' 
								2= 'Do not know'
								;	 
  	value syringereusef     			0= 'No'
								1= 'Yes'
								2= 'Do not know' 
								;
  	value proph24hourf      			0 = 'No'
								1 = 'Yes' 
								2 = 'Do not know'
								; 
  	value immhepbf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value immhepb_allf       			0= 'No'
	              	      			1= 'Yes' 
				      			;
  	value immtetanusf        			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value disposef           			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Rarely'
								4 = 'Never'
								; 
  	value traininjf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value trainexpf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value trainwheref        			1 = 'UTH'
								2 = 'Another hospital' 
								3 = 'Other'
								4 = 'A school'
				      			; 
  	value guidelinesf        			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value avoidf             			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value prevhivhepf 				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value universalf  				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value medhivexpf  				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value medhivexpavailf  				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivlowf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivworryf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hepworryf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value knowprevf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value knowalertf       				0= 'No'
	                      				1= 'Yes' 
				          			;
 	value bbfhivf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value bbfhepbf         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value bbfhepcf         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthivf           				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthepbf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthepcf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value pchivf           				0 = 'No'
								1= 'Yes' 
								;
  	value pchepbf          				0 = 'No'
								1 = 'Yes'
								;  
  	value pchepcf          	  			0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivhealthyf      				0= 'No'
	                      				1= 'Yes' 
				          	 		;
  	value hivcuref         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sharpcleanf         			0= 'No'
	                         			1= 'Yes' 
								2= 'Dont know'
				            		;
	value sharpbleachf        			0= 'No'
	                         			1= 'Yes'
	                         			2= 'Dont know' 
				            		;
	value sharpbloodf         			0= 'No'
	                         			1= 'Yes'
	                         			2= 'Dont know' 
				            		;
    value prophtimef 					1= 'Less than 2 hours' 
								2= 'Less than 24 hours' 
								3= 'Less than 72 hours' 
								4= 'Less than one week' 
								; 
proc import out=one
datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
DBMS=xlsx replace; 
getnames=yes; 
run; 
data one_new; 
	set one; 
	format 
	sex sexf. 
	occ occf.              
	Ptcare ptcaref.          		
	shift shiftf.            					           		
	specialty specialtyf.        		
	dept deptf.              	
	loc locf. 		      		
	**bleep** prickf.          		
	sharp sharpsf.         		
	sharpsyr sharpsyrf.        		
	injrecap injrecapf.       		
	injwaste injwastef.       		
	injsut injsutf.         		
	injdraw injdrawf.        		
	injiv injivf.          		
    	injsugar injsugarf.        		
	injvacc injvaccf.        		
	injor injorf.           		
	injsurg injsurgf.         		
	injclean injcleanf.        		
	injset injsetf.  	      	
    	splash splashf.        		
    	splashyr splashyrf.      		
    	splashoccur splashoccurf.   	 	
	worry worryf.         		
    	washsoap washsoapf.      		
    	washiodalc washiodalcf.    		
    	squeeze squeezef.      		
  	pressure pressuref.            	
  	alert alertf.               	
  	testhiv testhivf.             	
  	testhepb testhepbf.            	
  	testhepc testhepcf.            
  	proph prophf.               
  	tetanus tetanusf.             	
  	checkpth checkpthf.            	                      			
  	checkpthehepb checkpthepbf.         	
  	checkpthepc checkpthepcf.         	
  	responsena responsenaf.          	
  	alertno alertnof.             			
  	alerttime alerttimef.           	
  	alertperson alertpersonf.         	
  	prophtx prophtxf.       		
  	prophtneg prophtnegf.           	
  	prophptnohiv prophptnohivf.  		
  	prophlowrisk prophlowriskf.  		
  	prophneed prophneedf.     		 
  	prophhivfear prophhivfearf.  		
  	prophmeds prophmedsf.     		
  	prophout prophoutf.      		
  	prophna prophnaf.       		
  	hiv hivf.           		
  	hepb hepbf.          		
  	hepc hepcf.          		
  	needlerecap needlerecapf.   		
  	glovesdraw glovesdrawf.    		
  	glovesneedle glovesneedlef.  		
  	gloveprocedures gloveproceduresf.  		
  	glovedisposal glovedisposalf.   		
  	noglovesnotime noglovesnotimef.     	
  	noglovesmerg noglovesemergf.     	
  	noglovesunavail noglovesunavailf.   	
  	noglovescomfort noglovescomfortf.   	
  	noglovesdiff noglovesdifff.      	
  	noglovesnec noglovesnecf.       	
  	noglovesoth noglovesothf.       	
  	protective protectivef.        	 
  	washhands washhandsf.         	 
  	needlereuse needlereusef.       	 
  	syringereuse syringereusef.      	
  	proph24hour proph24hourf.       	 
  	immhepb immhepbf.           	
  	immhepb_all immhepb_allf.        	
  	immtetanus immtetanusf.         
  	dispose disposef.            	 
  	traininj traininjf.          	
  	trainexp trainexpf.           	
  	trainwhere trainwheref.         	 
  	guidelines guidelinesf.         	
  	avoid avoidf.              	
  	prevhivhep prevhivhepf.  		
  	universal universalf.   		
  	medhivexp medhivexpf.   		
  	medhivexpavail medhivexpavailf.   		
  	hivlow hivlowf.           		
  	hivworry hivworryf.         		
  	hepworry hepworryf.         		
  	knowprev knowprevf.         		
  	knowalert knowalertf.        		
 	bbfhiv bbfhivf.           		
  	bbfhepb bbfhepbf.          		
  	bbfhepc bbfhepcf.          		
  	sthiv sthivf.            		
  	sthepb sthepbf.           		
  	sthepc sthepcf.           			
  	pchiv pchivf.            		
  	pchepb pchepbf.           		 
  	pchepc pchepcf.           	  	
  	hivhealthy hivhealthyf.       		
  	hivcure hivcuref.          		
  	sharpclean sharpcleanf.          	
	sharpbleach sharpbleachf.         	
	sharpblood sharpbloodf.          	
    prophtime prophtimef. 
run;  
proc print data=one_new; 
run; 


The log for this code is here: 

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)
Licensed to BOSTON UNIVERSITY - SFA T&R, Site 70130214.
NOTE: This session is executing on the X64_10HOME platform.

 

NOTE: Updated analytical products:

SAS/STAT 14.3
SAS/ETS 14.3
SAS/OR 14.3
SAS/IML 14.3
SAS/QC 14.3

NOTE: Additional host information:

X64_10HOME WIN 10.0.17134 Workstation

NOTE: SAS initialization used:
real time 1.58 seconds
cpu time 1.31 seconds

NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.

1 proc format;
2 value sexf 1 = 'Female'
3 2 = 'Male'
4 ;
NOTE: Format SEXF has been output.
5 value occf 1 = 'Doctor'
6 2 = 'Medical student'
7 3 = 'Nurse midwife'
8 4 = 'Lab technician'
9 5 = 'Mortuary attendant'
10 6 = 'Clinical officer'
11 7 = 'Nurse'
12 8 = 'Nursing student'
13 9 = 'Housekeeper'
14 10 = 'Other'
15 11 = 'Dentist'
16 . = 'Missing'
17 ;
NOTE: Format OCCF has been output.
18 value ptcaref 1= 'Always'
19 2= 'Often'
20 3= 'Rarely'
21 4= 'Never'
22 ;
NOTE: Format PTCAREF has been output.
23 value shiftf 1='Day shift'
24 2='Evening/night shift'
25 3='Mixed shift (sometimes day, sometimes evening/night)'
26 ;
NOTE: Format SHIFTF has been output.
27 value specialtyf 1= 'Internal Medicine'
28 2= 'Pediatrics'
29 3= 'Anesthesiology'
30 4= 'Pathology'
31 5= 'Surgery'
32 6= 'Obstetrics/Gynecology'
33 7= 'Radiology'
34 8= 'Other'
35 ;
NOTE: Format SPECIALTYF has been output.
36 value deptf 1 = 'Medical Ward'
37 2 = 'Pediatric Ward'
38 3 = 'Operating Theatre'
39 4 = 'Dental Clinic'
40 5 = 'Surgical Ward'
41 6 = 'Ob/Gyn Ward'
42 7 = 'Emergency Ward'
43 8 = 'Dialysis clinic'
44 9 = 'Other'
45 10 = 'Intensive care unit'
46 11= 'Oncology Ward'
47 97= 'Not applicable (I work in many
48 locations)'
49 ;
NOTE: Format DEPTF has been output.
50 value locf 1 = 'Inpatient'
51 2 = 'Outpatient'
52 . = 'Missing'
53 ;
NOTE: Format LOCF has been output.
54 value prickf 0 = 'No'
55 1 = 'Yes'
56 ;
NOTE: Format PRICKF has been output.
57 value sharpsf 0 = 'No'
58 1= 'Yes'
59 ;
NOTE: Format SHARPSF has been output.
60 value sharpsyrf 0 = 'No'
61 1= 'Yes'
62 ;
NOTE: Format SHARPSYRF has been output.
63 value injrecapf 0 = 'No'
64 1 = 'Yes'
65 ;
NOTE: Format INJRECAPF has been output.
66 value injwastef 0 = 'No'
67 1 = 'Yes'
68 ;
NOTE: Format INJWASTEF has been output.
69 value injsutf 0 = 'No'
70 1 = 'Yes'
71 ;
NOTE: Format INJSUTF has been output.
72 value injdrawf 0 = 'No'
73 1 = 'Yes'
74 ;
NOTE: Format INJDRAWF has been output.
75 value injivf 0 = 'No'
76 1 = 'Yes'
77 ;
NOTE: Format INJIVF has been output.
78 value injsugarf 0 = 'No'
79 1 = 'Yes'
80 ;
NOTE: Format INJSUGARF has been output.
81 value injvaccf 0 = 'No'
82 1 = 'Yes'
83 ;
NOTE: Format INJVACCF has been output.
84 value injorf 0 = 'No'
85 1 = 'Yes'
86 ;
NOTE: Format INJORF has been output.
87 value injsurgf 0 = 'No'
88 1 = 'Yes'
89 ;
NOTE: Format INJSURGF has been output.
90 value injcleanf 0 = 'No'
91 1 = 'Yes'
92 ;
NOTE: Format INJCLEANF has been output.
93 value injsetf 1 = 'Hospital ward'
94 2 = 'Operating theatre'
95 3 = 'Emergency/casualty ward'
96 4 = 'Outpatient clinic'
97 5 = 'Laundry'
98 6 = 'Other'
99 7 = 'Mortuary'
100 8 = 'Hospital grounds'
101 ;
NOTE: Format INJSETF has been output.
102 value splashf 0 = 'No'
103 1 = 'Yes'
104 ;
NOTE: Format SPLASHF has been output.
105 value splashyrf 0 = 'No'
106 1 = 'Yes'
107 ;
NOTE: Format SPLASHYRF has been output.
108 value splashoccurf 1 = 'Hospital ward'
109 2 = 'Operating theatre'
110 3 = 'Emergency/casualty ward'
111 4 = 'Outpatient clinic'
112 5 = 'Laundry'
113 6 = 'Other'
114 ;
NOTE: Format SPLASHOCCURF has been output.
115 value worryf 1 = 'Worried'
116 2 = 'Not worried'
117 99 = 'Not applicable'
118 ;
NOTE: Format WORRYF has been output.
119 value washsoapf 0 = 'No'
120 1 = 'Yes'
121 ;
NOTE: Format WASHSOAPF has been output.
122 value washiodalcf 0 = 'No'
123 1 = 'Yes'
124 ;
NOTE: Format WASHIODALCF has been output.
125 value squeezef 0 = 'No'
126 1 = 'Yes'
127 ;
NOTE: Format SQUEEZEF has been output.
128 value pressuref 0 = 'No'
129 1 = 'Yes'
130 ;
NOTE: Format PRESSUREF has been output.
131 value alertf 0 = 'No'
132 1 = 'Yes'
133 ;
NOTE: Format ALERTF has been output.
134 value testhivf 0 = 'No'
135 1 = 'Yes'
136 ;
NOTE: Format TESTHIVF has been output.
137 value testhepbf 0 = 'No'
138 1 = 'Yes'
139 ;
NOTE: Format TESTHEPBF has been output.
140 value testhepcf 0 = 'No'
141 1 = 'Yes'
142 ;
NOTE: Format TESTHEPCF has been output.
143 value prophf 0 = 'No'
144 1 = 'Yes'
145 ;
NOTE: Format PROPHF has been output.
146 value tetanusf 0 = 'No'
147 1 = 'Yes'
148 ;
NOTE: Format TETANUSF has been output.
149 value checkpthf 0 = 'No'
150 1 = 'Yes'
151 ;
NOTE: Format CHECKPTHF has been output.
152 value checkpthepbf 0 = 'No'
153 1 = 'Yes'
154 ;
NOTE: Format CHECKPTHEPBF has been output.
155 value checkpthepcf 0 = 'No'
156 1 = 'Yes'
157 ;
NOTE: Format CHECKPTHEPCF has been output.
158 value responsenaf 0 = 'No'
159 1 = 'Yes'
160 ;
NOTE: Format RESPONSENAF has been output.
161 value alertnof 1 = 'Did not think it was important to my health'
162 2 = 'Did not know how to report the exposure'
163 3 = 'Did not have time'
164 4 = 'Worried that I would seem unprofessional or careless'
165 5 = 'Felt reporting would not change
166 outcome'
167 6 = 'No reporting system available'
168 7 = 'Other'
169 8 = 'Patient HIV nonreactive'
170 ;
NOTE: Format ALERTNOF has been output.
171 value alerttimef 1 = 'Less than 2 hours'
172 2 = 'Less than 24 hours'
173 3 = 'Less than 72 hours'
174 4 = 'Less than one week'
175 5 = 'Over one week'
176 6 = 'Other'
177 97 = 'Not applicable'
178 ;
NOTE: Format ALERTTIMEF has been output.
179 value alertpersonf 1 = 'Less than 2 hours'
180 2 = 'Less than 24 hours'
181 3 = 'Less than 72 hours'
182 4 = 'Less than one week'
183 5 = 'Over one week'
184 6 = 'Other'
185 97 = 'Not applicable'
186 ;
NOTE: Format ALERTPERSONF has been output.
187 value prophtxf 0 = 'No'
188 1 = 'Yes'
189 ;
NOTE: Format PROPHTXF has been output.
190 value prophtnegf 0 = 'No'
191 1 = 'Yes'
192 ;
NOTE: Format PROPHTNEGF has been output.
193 value prophptnohivf 0 = 'No'
194 1 = 'Yes'
195 ;
NOTE: Format PROPHPTNOHIVF has been output.
196 value prophlowriskf 0 = 'No'
197 1 = 'Yes'
198 ;
NOTE: Format PROPHLOWRISKF has been output.
199 value prophneedf 0 = 'No'
200 1 = 'Yes'
201 ;
NOTE: Format PROPHNEEDF has been output.
202 value prophsideefff 0 = 'No'
203 1 = 'Yes'
204 ;
NOTE: Format PROPHSIDEEFFF has been output.
205 value prophhivfearf 0 = 'No'
206 1 = 'Yes'
207 ;
NOTE: Format PROPHHIVFEARF has been output.
208 value prophmedsf 0 = 'No'
209 1 = 'Yes'
210 ;
NOTE: Format PROPHMEDSF has been output.
211 value prophoutf 0 = 'No'
212 1 = 'Yes'
213 ;
NOTE: Format PROPHOUTF has been output.
214 value prophnaf 0 = 'No'
215 1 = 'Yes'
216 ;
NOTE: Format PROPHNAF has been output.
217 value hivf 0 = 'No'
218 1 = 'Yes'
219 ;
NOTE: Format HIVF has been output.
220 value hepbf 0 = 'No'
221 1 = 'Yes'
222 ;
NOTE: Format HEPBF has been output.
223 value hepcf 0 = 'No'
224 1 = 'Yes'
225 ;
NOTE: Format HEPCF has been output.
226 value needlerecapf 0 = 'No'
227 1 = 'Yes'
228 ;
NOTE: Format NEEDLERECAPF has been output.
229 value glovesdrawf 1 = 'Always'
230 2 = 'Sometimes'
231 3 = 'Rarely'
232 4 = 'Never'
233 97 = 'Not applicable'
234 ;
NOTE: Format GLOVESDRAWF has been output.
235 value glovesneedlef 1 = 'Always'
236 2 = 'Sometimes'
237 3 = 'Rarely'
238 4 = 'Never'
239 97 = 'Not applicable'
240 ;
NOTE: Format GLOVESNEEDLEF has been output.
241 value gloveproceduresf 1 = 'Always'
242 2 = 'Sometimes'
243 3 = 'Rarely'
244 4 = 'Never'
245 97 = 'Not applicable'
246 ;
NOTE: Format GLOVEPROCEDURESF has been output.
247 value glovedisposalf 1 = 'Always'
248 2 = 'Sometimes'
249 3 = 'Rarely'
250 4 = 'Never'
251 97 = 'Not applicable'
252 ;
NOTE: Format GLOVEDISPOSALF has been output.
253 value noglovesnotimef 0 = 'No'
254 1 = 'Yes'
255 ;
NOTE: Format NOGLOVESNOTIMEF has been output.
256 value noglovesemergf 0 = 'No'
257 1 = 'Yes'
258 ;
NOTE: Format NOGLOVESEMERGF has been output.
259 value noglovesunavailf 0 = 'No'
260 1 = 'Yes'
261 ;
NOTE: Format NOGLOVESUNAVAILF has been output.
262 value noglovescomfortf 0 = 'No'
263 1 = 'Yes'
264 ;
NOTE: Format NOGLOVESCOMFORTF has been output.
265 value noglovesdifff 0 = 'No'
266 1 = 'Yes'
267 ;
NOTE: Format NOGLOVESDIFFF has been output.
268 value noglovesnecf 0 = 'No'
269 1 = 'Yes'
270 ;
NOTE: Format NOGLOVESNECF has been output.
271 value noglovesothf 0 = 'No'
272 1 = 'Yes'
273 ;
NOTE: Format NOGLOVESOTHF has been output.
274 value protectivef 1 = 'Always'
275 2 = 'Sometimes'
276 3 = 'Never'
277 ;
NOTE: Format PROTECTIVEF has been output.
278 value washhandsf 1 = 'Always'
279 2 = 'Sometimes'
280 3 = 'Never'
281 ;
NOTE: Format WASHHANDSF has been output.
282 value needlereusef 0= 'No'
283 1= 'Yes'
284 2= 'Do not know'
285 ;
NOTE: Format NEEDLEREUSEF has been output.
286 value syringereusef 0= 'No'
287 1= 'Yes'
288 2= 'Do not know'
289 ;
NOTE: Format SYRINGEREUSEF has been output.
290 value proph24hourf 0 = 'No'
291 1 = 'Yes'
292 2 = 'Do not know'
293 ;
NOTE: Format PROPH24HOURF has been output.
294 value immhepbf 0= 'No'
295 1= 'Yes'
296 ;
NOTE: Format IMMHEPBF has been output.
297 value immhepb_allf 0= 'No'
298 1= 'Yes'
299 ;
NOTE: Format IMMHEPB_ALLF has been output.
300 value immtetanusf 0= 'No'
301 1= 'Yes'
302 ;
NOTE: Format IMMTETANUSF has been output.
303 value disposef 1 = 'Always'
304 2 = 'Sometimes'
305 3 = 'Rarely'
306 4 = 'Never'
307 ;
NOTE: Format DISPOSEF has been output.
308 value traininjf 0= 'No'
309 1= 'Yes'
310 ;
NOTE: Format TRAININJF has been output.
311 value trainexpf 0= 'No'
312 1= 'Yes'
313 ;
NOTE: Format TRAINEXPF has been output.
314 value trainwheref 1 = 'UTH'
315 2 = 'Another hospital'
316 3 = 'Other'
317 4 = 'A school'
318 ;
NOTE: Format TRAINWHEREF has been output.
319 value guidelinesf 0= 'No'
320 1= 'Yes'
321 ;
NOTE: Format GUIDELINESF has been output.
322 value avoidf 0= 'No'
323 1= 'Yes'
324 ;
NOTE: Format AVOIDF has been output.
325 value prevhivhepf 0= 'No'
326 1= 'Yes'
327 ;
NOTE: Format PREVHIVHEPF has been output.
328 value universalf 0= 'No'
329 1= 'Yes'
330 ;
NOTE: Format UNIVERSALF has been output.
331 value medhivexpf 0= 'No'
332 1= 'Yes'
333 ;
NOTE: Format MEDHIVEXPF has been output.
334 value medhivexpavailf 0= 'No'
335 1= 'Yes'
336 ;
NOTE: Format MEDHIVEXPAVAILF has been output.
337 value hivlowf 0= 'No'
338 1= 'Yes'
339 ;
NOTE: Format HIVLOWF has been output.
340 value hivworryf 0= 'No'
341 1= 'Yes'
342 ;
NOTE: Format HIVWORRYF has been output.
343 value hepworryf 0= 'No'
344 1= 'Yes'
345 ;
NOTE: Format HEPWORRYF has been output.
346 value knowprevf 0= 'No'
347 1= 'Yes'
348 ;
NOTE: Format KNOWPREVF has been output.
349 value knowalertf 0= 'No'
350 1= 'Yes'
351 ;
NOTE: Format KNOWALERTF has been output.
352 value bbfhivf 0= 'No'
353 1= 'Yes'
354 ;
NOTE: Format BBFHIVF has been output.
355 value bbfhepbf 0= 'No'
356 1= 'Yes'
357 ;
NOTE: Format BBFHEPBF has been output.
358 value bbfhepcf 0= 'No'
359 1= 'Yes'
360 ;
NOTE: Format BBFHEPCF has been output.
361 value sthivf 0= 'No'
362 1= 'Yes'
363 ;
NOTE: Format STHIVF has been output.
364 value sthepbf 0= 'No'
365 1= 'Yes'
366 ;
NOTE: Format STHEPBF has been output.
367 value sthepcf 0= 'No'
368 1= 'Yes'
369 ;
NOTE: Format STHEPCF has been output.
370 value pchivf 0 = 'No'
371 1= 'Yes'
372 ;
NOTE: Format PCHIVF has been output.
373 value pchepbf 0 = 'No'
374 1 = 'Yes'
375 ;
NOTE: Format PCHEPBF has been output.
376 value pchepcf 0= 'No'
377 1= 'Yes'
378 ;
NOTE: Format PCHEPCF has been output.
379 value hivhealthyf 0= 'No'
380 1= 'Yes'
381 ;
NOTE: Format HIVHEALTHYF has been output.
382 value hivcuref 0= 'No'
383 1= 'Yes'
384 ;
NOTE: Format HIVCUREF has been output.
385 value sharpcleanf 0= 'No'
386 1= 'Yes'
387 2= 'Dont know'
388 ;
NOTE: Format SHARPCLEANF has been output.
389 value sharpbleachf 0= 'No'
390 1= 'Yes'
391 2= 'Dont know'
392 ;
NOTE: Format SHARPBLEACHF has been output.
393 value sharpbloodf 0= 'No'
394 1= 'Yes'
395 2= 'Dont know'
396 ;
NOTE: Format SHARPBLOODF has been output.
397 value prophtimef 1= 'Less than 2 hours'
398 2= 'Less than 24 hours'
399 3= 'Less than 72 hours'
400 4= 'Less than one week'
401 ;
NOTE: Format PROPHTIMEF has been output.

NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.31 seconds
cpu time 0.31 seconds


402 proc import out=one
403 datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
404 DBMS=xlsx replace;
405 getnames=yes;
406 run;

ERROR: Physical file does not exist, C:\Users\jackz\Desktop\SAS\BBFE.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

 

The TLDR version of this post is that I cannot read in an Excel file in SAS, which was exported from an Access database. Why is that? Also, why is SAS reading the pathway as 'C:\Users\jackz\Desktop\SAS\BBFE' rather than 'C:\Users\jackz\Desktop\SAS\BBFE.xlsx'? 

 

Thanks again for all of your help. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

1. Why are you re-reading over the file each time? Do it once and save the SAS data set to a library. 

2. What makes you think SAS can't read Access files? if you have the module which is required to use XLSX you may very well be able to read an Access DB.

 

Once you've read and validated the file is ok, then you can comment out the import step and just run it from the copying over step. 

 

libname myData 'path to folder to store SAS data sets';

*only do this one and verify then comment out;
proc import data=myData.one file='....' dbms=xlsx replace; run;


*brings file in to work with;
data one;
set myData.one;
run;


*rest of code is unchanged;

My first guess would be a network issue, but since the file is on the C drive that doesn't make sense. Do you ever have the file open? How are you running your code, highlighting and hitting run, F4?

 


@JackZ295 wrote:

I am currently working on a research project where the data has been stored in an Access database. I converted the Access database into an Excel spreadsheet, as SAS 9.4 cannot read in Access files. However, from time to time, SAS cannot find the Excel file using the pathway I provided. Here is the error: 

 

402 proc import out=one
403 datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
404 DBMS=xlsx replace;
405 getnames=yes;
406 run;

ERROR: Physical file does not exist, C:\Users\jackz\Desktop\SAS\BBFE.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

 

Does anyone know why this error is occuring? Also, why is SAS reading it as C:\Users\jackz\Desktop\SAS\BBFE instead of 'C:\Users\jackz\Desktop\SAS\BBFE.xlsx'? The pathway is definitely  'C:\Users\jackz\Desktop\SAS\BBFE.xlsx', as it has worked from time to time. Here is my entire code for context: 

 

 

proc format;
	value sexf              			1 = 'Female'
				      			2 = 'Male' 
				     	 			;
	value occf              			1 = 'Doctor'
				      			2 = 'Medical student'
				            		3 = 'Nurse midwife'
				            		4 = 'Lab technician'
				            		5 = 'Mortuary attendant'
				            		6 = 'Clinical officer'
				            		7 = 'Nurse'
				            		8 = 'Nursing student'
				            		9 = 'Housekeeper'
				           			10 = 'Other'
				           			11 = 'Dentist'
				           			. = 'Missing'
				           			;
	value ptcaref          				1= 'Always'
				           			2= 'Often' 
				           			3= 'Rarely'
				           			4= 'Never' 
				           			;
	value shiftf           				1='Day shift'
	                       				2='Evening/night shift'
3='Mixed shift (sometimes day, sometimes evening/night)'
				           			;
	value specialtyf       				1= 'Internal Medicine'
				           			2= 'Pediatrics'
				           			3= 'Anesthesiology' 
				           			4= 'Pathology'
				           			5= 'Surgery'
				           			6= 'Obstetrics/Gynecology' 
				           			7= 'Radiology'
				           			8= 'Other'
				           			;
	value deptf            				1 = 'Medical Ward'
				           			2 = 'Pediatric Ward' 
				           			3 = 'Operating Theatre' 
				           			4 = 'Dental Clinic' 
				           			5 = 'Surgical Ward' 
				           			6 = 'Ob/Gyn Ward' 
				           			7 = 'Emergency Ward'
                           				8 = 'Dialysis clinic' 
				           			9 = 'Other'
                          				10 = 'Intensive care unit'
                          				11= 'Oncology Ward'
                          				97= 'Not applicable (I work 
in many locations)'
				          			;	 
	value locf 		      			1 = 'Inpatient'
			   	          			2 = 'Outpatient'
			   	          			. = 'Missing'
			   	          			;
	value prickf          				0 = 'No'
		  		          			1 = 'Yes'
				          			;
	value sharpsf         				0 = 'No'
				          			1= 'Yes'
				          			;	
	value sharpsyrf        				0 = 'No'
				          			1= 'Yes'
				          			;
	value injrecapf       				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injwastef       				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injsutf         				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injdrawf        				0 = 'No'
				          			1 = 'Yes'
			              			;
	value injivf          				0 = 'No'
				          			1 = 'Yes'
				          			;
    value injsugarf       				0 = 'No'
			              			1 = 'Yes'
			              			;
	value injvaccf        				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injorf          				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injsurgf        				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injcleanf       				0 = 'No'
				          			1 = 'Yes'
			              			;
	value injsetf 	      			1 = 'Hospital ward'
				          			2 = 'Operating theatre'
				          			3 = 'Emergency/casualty ward'
				          			4 = 'Outpatient clinic'
				          			5 = 'Laundry'
				          			6 = 'Other'
				          			7 = 'Mortuary'
				          			8 = 'Hospital grounds'
				          			;
    value splashf       				0 = 'No'
			              			1 = 'Yes'
				          			;
    value splashyrf     				0 = 'No'
			              			1 = 'Yes'
				          			;
    value splashoccurf  	 			1 = 'Hospital ward'
				          			2 = 'Operating theatre'
				          			3 = 'Emergency/casualty ward'
				          			4 = 'Outpatient clinic'
				          			5 = 'Laundry'
								6 = 'Other'
                          				;
	value worryf        				1 = 'Worried'
				          			2 = 'Not worried'
				          			99 = 'Not applicable' 
				          			;
    value washsoapf      				0 = 'No'
			              			1 = 'Yes'
                          				;
    value washiodalcf   				0 = 'No'
			              			1 = 'Yes'
                          				;
    value squeezef     					0 = 'No'
			             			1 = 'Yes'
                         				;
  	value pressuref           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value alertf              			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhivf            			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhepbf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhepcf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value prophf              			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value tetanusf            			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthepbf        			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthepcf        			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value responsenaf         			0 = 'No'
			              			1 = 'Yes'
                          				;
value alertnof            			1 = 'Did not think it was 
important to my health'
2 = 'Did not know how to report the exposure'
				          			3 = 'Did not have time'
4 = 'Worried that I would seem unprofessional or careless' 
5 = 'Felt reporting would not change outcome'
				          			6 = 'No reporting system 
available'
				          			7 = 'Other'
8 = 'Patient HIV nonreactive'	
								;
  	value alerttimef          			1 = 'Less than 2 hours'
				          			2 = 'Less than 24 hours' 
				          			3 = 'Less than 72 hours'
				          			4 = 'Less than one week' 
				          			5 = 'Over one week'
				          			6 = 'Other'
				          			97 = 'Not applicable'
								;
  	value alertpersonf        			1 = 'Less than 2 hours'
				          			2 = 'Less than 24 hours' 
				          			3 = 'Less than 72 hours' 
				          			4 = 'Less than one week' 
				          			5 = 'Over one week'
				          			6 = 'Other'
				          			97 = 'Not applicable'
								;
  	value prophtxf      				0 = 'No'
			              			1 = 'Yes'
				          			;
  	value prophtnegf          			0 = 'No'
				          			1 = 'Yes'
				          			;
  	value prophptnohivf 				0 = 'No'
				          			1 = 'Yes'
				          			;
  	value prophlowriskf 				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophneedf    				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophsideefff  				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophhivfearf 				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophmedsf    				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophoutf     				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophnaf      				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hivf          				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hepbf         				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hepcf         				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value needlerecapf  				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value glovesdrawf   				1 = 'Always'
				  				2 = 'Sometimes'
  								3 = 'Rarely'
  								4 = 'Never'
  								97 = 'Not applicable'
  								;
  	value glovesneedlef 				1 = 'Always'
				  				2 = 'Sometimes'
  								3 = 'Rarely'
  								4 = 'Never'
  								97 = 'Not applicable'
  								;
  	value gloveproceduresf 				1 = 'Always'
				     				2 = 'Sometimes'
     								3 = 'Rarely'
     								4 = 'Never'
     								97 = 'Not applicable'
     								;
  	value glovedisposalf  				1 = 'Always'
				    				2 = 'Sometimes'
    								3 = 'Rarely'
    								4 = 'Never'
    								97 = 'Not applicable'
    								;
  	value noglovesnotimef    			0 = 'No'
			             			1 = 'Yes'
				       			;
  	value noglovesemergf    			0 = 'No'
				      			1 = 'Yes'
				      			;
  	value noglovesunavailf  			0 = 'No'
								1 = 'Yes'
								;
  	value noglovescomfortf  			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesdifff     			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesnecf      			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesothf      			0 = 'No'
								1 = 'Yes'
								;
  	value protectivef       			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Never'
								; 
  	value washhandsf        			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Never'
								; 
  	value needlereusef      			0= 'No'
				      			1= 'Yes' 
								2= 'Do not know'
								;	 
  	value syringereusef     			0= 'No'
								1= 'Yes'
								2= 'Do not know' 
								;
  	value proph24hourf      			0 = 'No'
								1 = 'Yes' 
								2 = 'Do not know'
								; 
  	value immhepbf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value immhepb_allf       			0= 'No'
	              	      			1= 'Yes' 
				      			;
  	value immtetanusf        			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value disposef           			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Rarely'
								4 = 'Never'
								; 
  	value traininjf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value trainexpf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value trainwheref        			1 = 'UTH'
								2 = 'Another hospital' 
								3 = 'Other'
								4 = 'A school'
				      			; 
  	value guidelinesf        			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value avoidf             			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value prevhivhepf 				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value universalf  				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value medhivexpf  				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value medhivexpavailf  				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivlowf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivworryf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hepworryf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value knowprevf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value knowalertf       				0= 'No'
	                      				1= 'Yes' 
				          			;
 	value bbfhivf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value bbfhepbf         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value bbfhepcf         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthivf           				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthepbf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthepcf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value pchivf           				0 = 'No'
								1= 'Yes' 
								;
  	value pchepbf          				0 = 'No'
								1 = 'Yes'
								;  
  	value pchepcf          	  			0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivhealthyf      				0= 'No'
	                      				1= 'Yes' 
				          	 		;
  	value hivcuref         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sharpcleanf         			0= 'No'
	                         			1= 'Yes' 
								2= 'Dont know'
				            		;
	value sharpbleachf        			0= 'No'
	                         			1= 'Yes'
	                         			2= 'Dont know' 
				            		;
	value sharpbloodf         			0= 'No'
	                         			1= 'Yes'
	                         			2= 'Dont know' 
				            		;
    value prophtimef 					1= 'Less than 2 hours' 
								2= 'Less than 24 hours' 
								3= 'Less than 72 hours' 
								4= 'Less than one week' 
								; 
proc import out=one
datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
DBMS=xlsx replace; 
getnames=yes; 
run; 
data one_new; 
	set one; 
	format 
	sex sexf. 
	occ occf.              
	Ptcare ptcaref.          		
	shift shiftf.            					           		
	specialty specialtyf.        		
	dept deptf.              	
	loc locf. 		      		
	**bleep** prickf.          		
	sharp sharpsf.         		
	sharpsyr sharpsyrf.        		
	injrecap injrecapf.       		
	injwaste injwastef.       		
	injsut injsutf.         		
	injdraw injdrawf.        		
	injiv injivf.          		
    	injsugar injsugarf.        		
	injvacc injvaccf.        		
	injor injorf.           		
	injsurg injsurgf.         		
	injclean injcleanf.        		
	injset injsetf.  	      	
    	splash splashf.        		
    	splashyr splashyrf.      		
    	splashoccur splashoccurf.   	 	
	worry worryf.         		
    	washsoap washsoapf.      		
    	washiodalc washiodalcf.    		
    	squeeze squeezef.      		
  	pressure pressuref.            	
  	alert alertf.               	
  	testhiv testhivf.             	
  	testhepb testhepbf.            	
  	testhepc testhepcf.            
  	proph prophf.               
  	tetanus tetanusf.             	
  	checkpth checkpthf.            	                      			
  	checkpthehepb checkpthepbf.         	
  	checkpthepc checkpthepcf.         	
  	responsena responsenaf.          	
  	alertno alertnof.             			
  	alerttime alerttimef.           	
  	alertperson alertpersonf.         	
  	prophtx prophtxf.       		
  	prophtneg prophtnegf.           	
  	prophptnohiv prophptnohivf.  		
  	prophlowrisk prophlowriskf.  		
  	prophneed prophneedf.     		 
  	prophhivfear prophhivfearf.  		
  	prophmeds prophmedsf.     		
  	prophout prophoutf.      		
  	prophna prophnaf.       		
  	hiv hivf.           		
  	hepb hepbf.          		
  	hepc hepcf.          		
  	needlerecap needlerecapf.   		
  	glovesdraw glovesdrawf.    		
  	glovesneedle glovesneedlef.  		
  	gloveprocedures gloveproceduresf.  		
  	glovedisposal glovedisposalf.   		
  	noglovesnotime noglovesnotimef.     	
  	noglovesmerg noglovesemergf.     	
  	noglovesunavail noglovesunavailf.   	
  	noglovescomfort noglovescomfortf.   	
  	noglovesdiff noglovesdifff.      	
  	noglovesnec noglovesnecf.       	
  	noglovesoth noglovesothf.       	
  	protective protectivef.        	 
  	washhands washhandsf.         	 
  	needlereuse needlereusef.       	 
  	syringereuse syringereusef.      	
  	proph24hour proph24hourf.       	 
  	immhepb immhepbf.           	
  	immhepb_all immhepb_allf.        	
  	immtetanus immtetanusf.         
  	dispose disposef.            	 
  	traininj traininjf.          	
  	trainexp trainexpf.           	
  	trainwhere trainwheref.         	 
  	guidelines guidelinesf.         	
  	avoid avoidf.              	
  	prevhivhep prevhivhepf.  		
  	universal universalf.   		
  	medhivexp medhivexpf.   		
  	medhivexpavail medhivexpavailf.   		
  	hivlow hivlowf.           		
  	hivworry hivworryf.         		
  	hepworry hepworryf.         		
  	knowprev knowprevf.         		
  	knowalert knowalertf.        		
 	bbfhiv bbfhivf.           		
  	bbfhepb bbfhepbf.          		
  	bbfhepc bbfhepcf.          		
  	sthiv sthivf.            		
  	sthepb sthepbf.           		
  	sthepc sthepcf.           			
  	pchiv pchivf.            		
  	pchepb pchepbf.           		 
  	pchepc pchepcf.           	  	
  	hivhealthy hivhealthyf.       		
  	hivcure hivcuref.          		
  	sharpclean sharpcleanf.          	
	sharpbleach sharpbleachf.         	
	sharpblood sharpbloodf.          	
    prophtime prophtimef. 
run;  
proc print data=one_new; 
run; 


The log for this code is here: 

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)
Licensed to BOSTON UNIVERSITY - SFA T&R, Site 70130214.
NOTE: This session is executing on the X64_10HOME platform.

 

NOTE: Updated analytical products:

SAS/STAT 14.3
SAS/ETS 14.3
SAS/OR 14.3
SAS/IML 14.3
SAS/QC 14.3

NOTE: Additional host information:

X64_10HOME WIN 10.0.17134 Workstation

NOTE: SAS initialization used:
real time 1.58 seconds
cpu time 1.31 seconds

NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.

1 proc format;
2 value sexf 1 = 'Female'
3 2 = 'Male'
4 ;
NOTE: Format SEXF has been output.
5 value occf 1 = 'Doctor'
6 2 = 'Medical student'
7 3 = 'Nurse midwife'
8 4 = 'Lab technician'
9 5 = 'Mortuary attendant'
10 6 = 'Clinical officer'
11 7 = 'Nurse'
12 8 = 'Nursing student'
13 9 = 'Housekeeper'
14 10 = 'Other'
15 11 = 'Dentist'
16 . = 'Missing'
17 ;
NOTE: Format OCCF has been output.
18 value ptcaref 1= 'Always'
19 2= 'Often'
20 3= 'Rarely'
21 4= 'Never'
22 ;
NOTE: Format PTCAREF has been output.
23 value shiftf 1='Day shift'
24 2='Evening/night shift'
25 3='Mixed shift (sometimes day, sometimes evening/night)'
26 ;
NOTE: Format SHIFTF has been output.
27 value specialtyf 1= 'Internal Medicine'
28 2= 'Pediatrics'
29 3= 'Anesthesiology'
30 4= 'Pathology'
31 5= 'Surgery'
32 6= 'Obstetrics/Gynecology'
33 7= 'Radiology'
34 8= 'Other'
35 ;
NOTE: Format SPECIALTYF has been output.
36 value deptf 1 = 'Medical Ward'
37 2 = 'Pediatric Ward'
38 3 = 'Operating Theatre'
39 4 = 'Dental Clinic'
40 5 = 'Surgical Ward'
41 6 = 'Ob/Gyn Ward'
42 7 = 'Emergency Ward'
43 8 = 'Dialysis clinic'
44 9 = 'Other'
45 10 = 'Intensive care unit'
46 11= 'Oncology Ward'
47 97= 'Not applicable (I work in many
48 locations)'
49 ;
NOTE: Format DEPTF has been output.
50 value locf 1 = 'Inpatient'
51 2 = 'Outpatient'
52 . = 'Missing'
53 ;
NOTE: Format LOCF has been output.
54 value prickf 0 = 'No'
55 1 = 'Yes'
56 ;
NOTE: Format PRICKF has been output.
57 value sharpsf 0 = 'No'
58 1= 'Yes'
59 ;
NOTE: Format SHARPSF has been output.
60 value sharpsyrf 0 = 'No'
61 1= 'Yes'
62 ;
NOTE: Format SHARPSYRF has been output.
63 value injrecapf 0 = 'No'
64 1 = 'Yes'
65 ;
NOTE: Format INJRECAPF has been output.
66 value injwastef 0 = 'No'
67 1 = 'Yes'
68 ;
NOTE: Format INJWASTEF has been output.
69 value injsutf 0 = 'No'
70 1 = 'Yes'
71 ;
NOTE: Format INJSUTF has been output.
72 value injdrawf 0 = 'No'
73 1 = 'Yes'
74 ;
NOTE: Format INJDRAWF has been output.
75 value injivf 0 = 'No'
76 1 = 'Yes'
77 ;
NOTE: Format INJIVF has been output.
78 value injsugarf 0 = 'No'
79 1 = 'Yes'
80 ;
NOTE: Format INJSUGARF has been output.
81 value injvaccf 0 = 'No'
82 1 = 'Yes'
83 ;
NOTE: Format INJVACCF has been output.
84 value injorf 0 = 'No'
85 1 = 'Yes'
86 ;
NOTE: Format INJORF has been output.
87 value injsurgf 0 = 'No'
88 1 = 'Yes'
89 ;
NOTE: Format INJSURGF has been output.
90 value injcleanf 0 = 'No'
91 1 = 'Yes'
92 ;
NOTE: Format INJCLEANF has been output.
93 value injsetf 1 = 'Hospital ward'
94 2 = 'Operating theatre'
95 3 = 'Emergency/casualty ward'
96 4 = 'Outpatient clinic'
97 5 = 'Laundry'
98 6 = 'Other'
99 7 = 'Mortuary'
100 8 = 'Hospital grounds'
101 ;
NOTE: Format INJSETF has been output.
102 value splashf 0 = 'No'
103 1 = 'Yes'
104 ;
NOTE: Format SPLASHF has been output.
105 value splashyrf 0 = 'No'
106 1 = 'Yes'
107 ;
NOTE: Format SPLASHYRF has been output.
108 value splashoccurf 1 = 'Hospital ward'
109 2 = 'Operating theatre'
110 3 = 'Emergency/casualty ward'
111 4 = 'Outpatient clinic'
112 5 = 'Laundry'
113 6 = 'Other'
114 ;
NOTE: Format SPLASHOCCURF has been output.
115 value worryf 1 = 'Worried'
116 2 = 'Not worried'
117 99 = 'Not applicable'
118 ;
NOTE: Format WORRYF has been output.
119 value washsoapf 0 = 'No'
120 1 = 'Yes'
121 ;
NOTE: Format WASHSOAPF has been output.
122 value washiodalcf 0 = 'No'
123 1 = 'Yes'
124 ;
NOTE: Format WASHIODALCF has been output.
125 value squeezef 0 = 'No'
126 1 = 'Yes'
127 ;
NOTE: Format SQUEEZEF has been output.
128 value pressuref 0 = 'No'
129 1 = 'Yes'
130 ;
NOTE: Format PRESSUREF has been output.
131 value alertf 0 = 'No'
132 1 = 'Yes'
133 ;
NOTE: Format ALERTF has been output.
134 value testhivf 0 = 'No'
135 1 = 'Yes'
136 ;
NOTE: Format TESTHIVF has been output.
137 value testhepbf 0 = 'No'
138 1 = 'Yes'
139 ;
NOTE: Format TESTHEPBF has been output.
140 value testhepcf 0 = 'No'
141 1 = 'Yes'
142 ;
NOTE: Format TESTHEPCF has been output.
143 value prophf 0 = 'No'
144 1 = 'Yes'
145 ;
NOTE: Format PROPHF has been output.
146 value tetanusf 0 = 'No'
147 1 = 'Yes'
148 ;
NOTE: Format TETANUSF has been output.
149 value checkpthf 0 = 'No'
150 1 = 'Yes'
151 ;
NOTE: Format CHECKPTHF has been output.
152 value checkpthepbf 0 = 'No'
153 1 = 'Yes'
154 ;
NOTE: Format CHECKPTHEPBF has been output.
155 value checkpthepcf 0 = 'No'
156 1 = 'Yes'
157 ;
NOTE: Format CHECKPTHEPCF has been output.
158 value responsenaf 0 = 'No'
159 1 = 'Yes'
160 ;
NOTE: Format RESPONSENAF has been output.
161 value alertnof 1 = 'Did not think it was important to my health'
162 2 = 'Did not know how to report the exposure'
163 3 = 'Did not have time'
164 4 = 'Worried that I would seem unprofessional or careless'
165 5 = 'Felt reporting would not change
166 outcome'
167 6 = 'No reporting system available'
168 7 = 'Other'
169 8 = 'Patient HIV nonreactive'
170 ;
NOTE: Format ALERTNOF has been output.
171 value alerttimef 1 = 'Less than 2 hours'
172 2 = 'Less than 24 hours'
173 3 = 'Less than 72 hours'
174 4 = 'Less than one week'
175 5 = 'Over one week'
176 6 = 'Other'
177 97 = 'Not applicable'
178 ;
NOTE: Format ALERTTIMEF has been output.
179 value alertpersonf 1 = 'Less than 2 hours'
180 2 = 'Less than 24 hours'
181 3 = 'Less than 72 hours'
182 4 = 'Less than one week'
183 5 = 'Over one week'
184 6 = 'Other'
185 97 = 'Not applicable'
186 ;
NOTE: Format ALERTPERSONF has been output.
187 value prophtxf 0 = 'No'
188 1 = 'Yes'
189 ;
NOTE: Format PROPHTXF has been output.
190 value prophtnegf 0 = 'No'
191 1 = 'Yes'
192 ;
NOTE: Format PROPHTNEGF has been output.
193 value prophptnohivf 0 = 'No'
194 1 = 'Yes'
195 ;
NOTE: Format PROPHPTNOHIVF has been output.
196 value prophlowriskf 0 = 'No'
197 1 = 'Yes'
198 ;
NOTE: Format PROPHLOWRISKF has been output.
199 value prophneedf 0 = 'No'
200 1 = 'Yes'
201 ;
NOTE: Format PROPHNEEDF has been output.
202 value prophsideefff 0 = 'No'
203 1 = 'Yes'
204 ;
NOTE: Format PROPHSIDEEFFF has been output.
205 value prophhivfearf 0 = 'No'
206 1 = 'Yes'
207 ;
NOTE: Format PROPHHIVFEARF has been output.
208 value prophmedsf 0 = 'No'
209 1 = 'Yes'
210 ;
NOTE: Format PROPHMEDSF has been output.
211 value prophoutf 0 = 'No'
212 1 = 'Yes'
213 ;
NOTE: Format PROPHOUTF has been output.
214 value prophnaf 0 = 'No'
215 1 = 'Yes'
216 ;
NOTE: Format PROPHNAF has been output.
217 value hivf 0 = 'No'
218 1 = 'Yes'
219 ;
NOTE: Format HIVF has been output.
220 value hepbf 0 = 'No'
221 1 = 'Yes'
222 ;
NOTE: Format HEPBF has been output.
223 value hepcf 0 = 'No'
224 1 = 'Yes'
225 ;
NOTE: Format HEPCF has been output.
226 value needlerecapf 0 = 'No'
227 1 = 'Yes'
228 ;
NOTE: Format NEEDLERECAPF has been output.
229 value glovesdrawf 1 = 'Always'
230 2 = 'Sometimes'
231 3 = 'Rarely'
232 4 = 'Never'
233 97 = 'Not applicable'
234 ;
NOTE: Format GLOVESDRAWF has been output.
235 value glovesneedlef 1 = 'Always'
236 2 = 'Sometimes'
237 3 = 'Rarely'
238 4 = 'Never'
239 97 = 'Not applicable'
240 ;
NOTE: Format GLOVESNEEDLEF has been output.
241 value gloveproceduresf 1 = 'Always'
242 2 = 'Sometimes'
243 3 = 'Rarely'
244 4 = 'Never'
245 97 = 'Not applicable'
246 ;
NOTE: Format GLOVEPROCEDURESF has been output.
247 value glovedisposalf 1 = 'Always'
248 2 = 'Sometimes'
249 3 = 'Rarely'
250 4 = 'Never'
251 97 = 'Not applicable'
252 ;
NOTE: Format GLOVEDISPOSALF has been output.
253 value noglovesnotimef 0 = 'No'
254 1 = 'Yes'
255 ;
NOTE: Format NOGLOVESNOTIMEF has been output.
256 value noglovesemergf 0 = 'No'
257 1 = 'Yes'
258 ;
NOTE: Format NOGLOVESEMERGF has been output.
259 value noglovesunavailf 0 = 'No'
260 1 = 'Yes'
261 ;
NOTE: Format NOGLOVESUNAVAILF has been output.
262 value noglovescomfortf 0 = 'No'
263 1 = 'Yes'
264 ;
NOTE: Format NOGLOVESCOMFORTF has been output.
265 value noglovesdifff 0 = 'No'
266 1 = 'Yes'
267 ;
NOTE: Format NOGLOVESDIFFF has been output.
268 value noglovesnecf 0 = 'No'
269 1 = 'Yes'
270 ;
NOTE: Format NOGLOVESNECF has been output.
271 value noglovesothf 0 = 'No'
272 1 = 'Yes'
273 ;
NOTE: Format NOGLOVESOTHF has been output.
274 value protectivef 1 = 'Always'
275 2 = 'Sometimes'
276 3 = 'Never'
277 ;
NOTE: Format PROTECTIVEF has been output.
278 value washhandsf 1 = 'Always'
279 2 = 'Sometimes'
280 3 = 'Never'
281 ;
NOTE: Format WASHHANDSF has been output.
282 value needlereusef 0= 'No'
283 1= 'Yes'
284 2= 'Do not know'
285 ;
NOTE: Format NEEDLEREUSEF has been output.
286 value syringereusef 0= 'No'
287 1= 'Yes'
288 2= 'Do not know'
289 ;
NOTE: Format SYRINGEREUSEF has been output.
290 value proph24hourf 0 = 'No'
291 1 = 'Yes'
292 2 = 'Do not know'
293 ;
NOTE: Format PROPH24HOURF has been output.
294 value immhepbf 0= 'No'
295 1= 'Yes'
296 ;
NOTE: Format IMMHEPBF has been output.
297 value immhepb_allf 0= 'No'
298 1= 'Yes'
299 ;
NOTE: Format IMMHEPB_ALLF has been output.
300 value immtetanusf 0= 'No'
301 1= 'Yes'
302 ;
NOTE: Format IMMTETANUSF has been output.
303 value disposef 1 = 'Always'
304 2 = 'Sometimes'
305 3 = 'Rarely'
306 4 = 'Never'
307 ;
NOTE: Format DISPOSEF has been output.
308 value traininjf 0= 'No'
309 1= 'Yes'
310 ;
NOTE: Format TRAININJF has been output.
311 value trainexpf 0= 'No'
312 1= 'Yes'
313 ;
NOTE: Format TRAINEXPF has been output.
314 value trainwheref 1 = 'UTH'
315 2 = 'Another hospital'
316 3 = 'Other'
317 4 = 'A school'
318 ;
NOTE: Format TRAINWHEREF has been output.
319 value guidelinesf 0= 'No'
320 1= 'Yes'
321 ;
NOTE: Format GUIDELINESF has been output.
322 value avoidf 0= 'No'
323 1= 'Yes'
324 ;
NOTE: Format AVOIDF has been output.
325 value prevhivhepf 0= 'No'
326 1= 'Yes'
327 ;
NOTE: Format PREVHIVHEPF has been output.
328 value universalf 0= 'No'
329 1= 'Yes'
330 ;
NOTE: Format UNIVERSALF has been output.
331 value medhivexpf 0= 'No'
332 1= 'Yes'
333 ;
NOTE: Format MEDHIVEXPF has been output.
334 value medhivexpavailf 0= 'No'
335 1= 'Yes'
336 ;
NOTE: Format MEDHIVEXPAVAILF has been output.
337 value hivlowf 0= 'No'
338 1= 'Yes'
339 ;
NOTE: Format HIVLOWF has been output.
340 value hivworryf 0= 'No'
341 1= 'Yes'
342 ;
NOTE: Format HIVWORRYF has been output.
343 value hepworryf 0= 'No'
344 1= 'Yes'
345 ;
NOTE: Format HEPWORRYF has been output.
346 value knowprevf 0= 'No'
347 1= 'Yes'
348 ;
NOTE: Format KNOWPREVF has been output.
349 value knowalertf 0= 'No'
350 1= 'Yes'
351 ;
NOTE: Format KNOWALERTF has been output.
352 value bbfhivf 0= 'No'
353 1= 'Yes'
354 ;
NOTE: Format BBFHIVF has been output.
355 value bbfhepbf 0= 'No'
356 1= 'Yes'
357 ;
NOTE: Format BBFHEPBF has been output.
358 value bbfhepcf 0= 'No'
359 1= 'Yes'
360 ;
NOTE: Format BBFHEPCF has been output.
361 value sthivf 0= 'No'
362 1= 'Yes'
363 ;
NOTE: Format STHIVF has been output.
364 value sthepbf 0= 'No'
365 1= 'Yes'
366 ;
NOTE: Format STHEPBF has been output.
367 value sthepcf 0= 'No'
368 1= 'Yes'
369 ;
NOTE: Format STHEPCF has been output.
370 value pchivf 0 = 'No'
371 1= 'Yes'
372 ;
NOTE: Format PCHIVF has been output.
373 value pchepbf 0 = 'No'
374 1 = 'Yes'
375 ;
NOTE: Format PCHEPBF has been output.
376 value pchepcf 0= 'No'
377 1= 'Yes'
378 ;
NOTE: Format PCHEPCF has been output.
379 value hivhealthyf 0= 'No'
380 1= 'Yes'
381 ;
NOTE: Format HIVHEALTHYF has been output.
382 value hivcuref 0= 'No'
383 1= 'Yes'
384 ;
NOTE: Format HIVCUREF has been output.
385 value sharpcleanf 0= 'No'
386 1= 'Yes'
387 2= 'Dont know'
388 ;
NOTE: Format SHARPCLEANF has been output.
389 value sharpbleachf 0= 'No'
390 1= 'Yes'
391 2= 'Dont know'
392 ;
NOTE: Format SHARPBLEACHF has been output.
393 value sharpbloodf 0= 'No'
394 1= 'Yes'
395 2= 'Dont know'
396 ;
NOTE: Format SHARPBLOODF has been output.
397 value prophtimef 1= 'Less than 2 hours'
398 2= 'Less than 24 hours'
399 3= 'Less than 72 hours'
400 4= 'Less than one week'
401 ;
NOTE: Format PROPHTIMEF has been output.

NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.31 seconds
cpu time 0.31 seconds


402 proc import out=one
403 datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
404 DBMS=xlsx replace;
405 getnames=yes;
406 run;

ERROR: Physical file does not exist, C:\Users\jackz\Desktop\SAS\BBFE.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

 

The TLDR version of this post is that I cannot read in an Excel file in SAS, which was exported from an Access database. Why is that? Also, why is SAS reading the pathway as 'C:\Users\jackz\Desktop\SAS\BBFE' rather than 'C:\Users\jackz\Desktop\SAS\BBFE.xlsx'? 

 

Thanks again for all of your help. 

 


 

View solution in original post

11 REPLIES 11
JackZ295
Pyrite | Level 9

Thanks. Does this work with mdb files? The Access file is an mdb file. 

JackZ295
Pyrite | Level 9

Thanks! I tried doing that, but I ran into issues. Would you mind giving hints as to what went wrong? 

Here is the code from my second attempt: 

 

libname BBFS 'C:\Users\jackz\Desktop\BBFE Study'; 
proc import out=BBFS.one
datafile='C:\Users\jackz\Desktop\BBFE Study\Pierre study 30Jan13.mdb' 
dbms=access replace; 
run; 

Here is the log with the errors: 

 

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)
Licensed to BOSTON UNIVERSITY - SFA T&R, Site 70130214.
NOTE: This session is executing on the X64_10HOME platform.

 

NOTE: Updated analytical products:

SAS/STAT 14.3
SAS/ETS 14.3
SAS/OR 14.3
SAS/IML 14.3
SAS/QC 14.3

NOTE: Additional host information:

X64_10HOME WIN 10.0.17134 Workstation

NOTE: SAS initialization used:
real time 1.51 seconds
cpu time 1.26 seconds

NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.

1 libname BBFS 'C:\Users\jackz\Desktop\BBFE Study';
NOTE: Libref BBFS was successfully assigned as follows:
Engine: V9
Physical Name: C:\Users\jackz\Desktop\BBFE Study

2 proc import out=BBFS.one
3 datafile='C:\Users\jackz\Desktop\BBFE Study\Pierre study 30Jan13.mdb'
4 dbms=mdb replace;
ERROR: DBMS type MDB not valid for import.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

5 run;


6 proc import out=BBFS.one
7 datafile='C:\Users\jackz\Desktop\BBFE Study\Pierre study 30Jan13.mdb'
8 dbms=access replace;
9 run;

ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.
ERROR: Connection Failed. See log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.26 seconds
cpu time 0.17 seconds

 

In my log, you will also see my first attempt. What went wrong? Also, in the tutorial, isn't "libref" just the name of the library? The example from the link is posted below: 

 

LIBNAME libref 'C:\PCFData\Demo.accdb';

I haven't tried it the way below, but I would still have to include a proc import procedure, correct:

 

LIBNAME libref ACCESS PATH='C:\PCFData\Demo.accdb'; 

If so,  I'm assuming that I would run into similar issues when it comes to actually importing the Access file. What am I doing wrong? Is there a way around this? 

 

Thanks again for all of your help. 

Reeza
Super User

1. Why are you re-reading over the file each time? Do it once and save the SAS data set to a library. 

2. What makes you think SAS can't read Access files? if you have the module which is required to use XLSX you may very well be able to read an Access DB.

 

Once you've read and validated the file is ok, then you can comment out the import step and just run it from the copying over step. 

 

libname myData 'path to folder to store SAS data sets';

*only do this one and verify then comment out;
proc import data=myData.one file='....' dbms=xlsx replace; run;


*brings file in to work with;
data one;
set myData.one;
run;


*rest of code is unchanged;

My first guess would be a network issue, but since the file is on the C drive that doesn't make sense. Do you ever have the file open? How are you running your code, highlighting and hitting run, F4?

 


@JackZ295 wrote:

I am currently working on a research project where the data has been stored in an Access database. I converted the Access database into an Excel spreadsheet, as SAS 9.4 cannot read in Access files. However, from time to time, SAS cannot find the Excel file using the pathway I provided. Here is the error: 

 

402 proc import out=one
403 datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
404 DBMS=xlsx replace;
405 getnames=yes;
406 run;

ERROR: Physical file does not exist, C:\Users\jackz\Desktop\SAS\BBFE.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

 

Does anyone know why this error is occuring? Also, why is SAS reading it as C:\Users\jackz\Desktop\SAS\BBFE instead of 'C:\Users\jackz\Desktop\SAS\BBFE.xlsx'? The pathway is definitely  'C:\Users\jackz\Desktop\SAS\BBFE.xlsx', as it has worked from time to time. Here is my entire code for context: 

 

 

proc format;
	value sexf              			1 = 'Female'
				      			2 = 'Male' 
				     	 			;
	value occf              			1 = 'Doctor'
				      			2 = 'Medical student'
				            		3 = 'Nurse midwife'
				            		4 = 'Lab technician'
				            		5 = 'Mortuary attendant'
				            		6 = 'Clinical officer'
				            		7 = 'Nurse'
				            		8 = 'Nursing student'
				            		9 = 'Housekeeper'
				           			10 = 'Other'
				           			11 = 'Dentist'
				           			. = 'Missing'
				           			;
	value ptcaref          				1= 'Always'
				           			2= 'Often' 
				           			3= 'Rarely'
				           			4= 'Never' 
				           			;
	value shiftf           				1='Day shift'
	                       				2='Evening/night shift'
3='Mixed shift (sometimes day, sometimes evening/night)'
				           			;
	value specialtyf       				1= 'Internal Medicine'
				           			2= 'Pediatrics'
				           			3= 'Anesthesiology' 
				           			4= 'Pathology'
				           			5= 'Surgery'
				           			6= 'Obstetrics/Gynecology' 
				           			7= 'Radiology'
				           			8= 'Other'
				           			;
	value deptf            				1 = 'Medical Ward'
				           			2 = 'Pediatric Ward' 
				           			3 = 'Operating Theatre' 
				           			4 = 'Dental Clinic' 
				           			5 = 'Surgical Ward' 
				           			6 = 'Ob/Gyn Ward' 
				           			7 = 'Emergency Ward'
                           				8 = 'Dialysis clinic' 
				           			9 = 'Other'
                          				10 = 'Intensive care unit'
                          				11= 'Oncology Ward'
                          				97= 'Not applicable (I work 
in many locations)'
				          			;	 
	value locf 		      			1 = 'Inpatient'
			   	          			2 = 'Outpatient'
			   	          			. = 'Missing'
			   	          			;
	value prickf          				0 = 'No'
		  		          			1 = 'Yes'
				          			;
	value sharpsf         				0 = 'No'
				          			1= 'Yes'
				          			;	
	value sharpsyrf        				0 = 'No'
				          			1= 'Yes'
				          			;
	value injrecapf       				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injwastef       				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injsutf         				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injdrawf        				0 = 'No'
				          			1 = 'Yes'
			              			;
	value injivf          				0 = 'No'
				          			1 = 'Yes'
				          			;
    value injsugarf       				0 = 'No'
			              			1 = 'Yes'
			              			;
	value injvaccf        				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injorf          				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injsurgf        				0 = 'No'
				          			1 = 'Yes'
				          			;
	value injcleanf       				0 = 'No'
				          			1 = 'Yes'
			              			;
	value injsetf 	      			1 = 'Hospital ward'
				          			2 = 'Operating theatre'
				          			3 = 'Emergency/casualty ward'
				          			4 = 'Outpatient clinic'
				          			5 = 'Laundry'
				          			6 = 'Other'
				          			7 = 'Mortuary'
				          			8 = 'Hospital grounds'
				          			;
    value splashf       				0 = 'No'
			              			1 = 'Yes'
				          			;
    value splashyrf     				0 = 'No'
			              			1 = 'Yes'
				          			;
    value splashoccurf  	 			1 = 'Hospital ward'
				          			2 = 'Operating theatre'
				          			3 = 'Emergency/casualty ward'
				          			4 = 'Outpatient clinic'
				          			5 = 'Laundry'
								6 = 'Other'
                          				;
	value worryf        				1 = 'Worried'
				          			2 = 'Not worried'
				          			99 = 'Not applicable' 
				          			;
    value washsoapf      				0 = 'No'
			              			1 = 'Yes'
                          				;
    value washiodalcf   				0 = 'No'
			              			1 = 'Yes'
                          				;
    value squeezef     					0 = 'No'
			             			1 = 'Yes'
                         				;
  	value pressuref           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value alertf              			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhivf            			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhepbf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value testhepcf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value prophf              			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value tetanusf            			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthf           			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthepbf        			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value checkpthepcf        			0 = 'No'
			              			1 = 'Yes'
                          				;
  	value responsenaf         			0 = 'No'
			              			1 = 'Yes'
                          				;
value alertnof            			1 = 'Did not think it was 
important to my health'
2 = 'Did not know how to report the exposure'
				          			3 = 'Did not have time'
4 = 'Worried that I would seem unprofessional or careless' 
5 = 'Felt reporting would not change outcome'
				          			6 = 'No reporting system 
available'
				          			7 = 'Other'
8 = 'Patient HIV nonreactive'	
								;
  	value alerttimef          			1 = 'Less than 2 hours'
				          			2 = 'Less than 24 hours' 
				          			3 = 'Less than 72 hours'
				          			4 = 'Less than one week' 
				          			5 = 'Over one week'
				          			6 = 'Other'
				          			97 = 'Not applicable'
								;
  	value alertpersonf        			1 = 'Less than 2 hours'
				          			2 = 'Less than 24 hours' 
				          			3 = 'Less than 72 hours' 
				          			4 = 'Less than one week' 
				          			5 = 'Over one week'
				          			6 = 'Other'
				          			97 = 'Not applicable'
								;
  	value prophtxf      				0 = 'No'
			              			1 = 'Yes'
				          			;
  	value prophtnegf          			0 = 'No'
				          			1 = 'Yes'
				          			;
  	value prophptnohivf 				0 = 'No'
				          			1 = 'Yes'
				          			;
  	value prophlowriskf 				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophneedf    				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophsideefff  				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophhivfearf 				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophmedsf    				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophoutf     				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value prophnaf      				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hivf          				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hepbf         				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value hepcf         				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value needlerecapf  				0 = 'No'
				  				1 = 'Yes'
				  				;
  	value glovesdrawf   				1 = 'Always'
				  				2 = 'Sometimes'
  								3 = 'Rarely'
  								4 = 'Never'
  								97 = 'Not applicable'
  								;
  	value glovesneedlef 				1 = 'Always'
				  				2 = 'Sometimes'
  								3 = 'Rarely'
  								4 = 'Never'
  								97 = 'Not applicable'
  								;
  	value gloveproceduresf 				1 = 'Always'
				     				2 = 'Sometimes'
     								3 = 'Rarely'
     								4 = 'Never'
     								97 = 'Not applicable'
     								;
  	value glovedisposalf  				1 = 'Always'
				    				2 = 'Sometimes'
    								3 = 'Rarely'
    								4 = 'Never'
    								97 = 'Not applicable'
    								;
  	value noglovesnotimef    			0 = 'No'
			             			1 = 'Yes'
				       			;
  	value noglovesemergf    			0 = 'No'
				      			1 = 'Yes'
				      			;
  	value noglovesunavailf  			0 = 'No'
								1 = 'Yes'
								;
  	value noglovescomfortf  			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesdifff     			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesnecf      			0 = 'No'
								1 = 'Yes'
								;
  	value noglovesothf      			0 = 'No'
								1 = 'Yes'
								;
  	value protectivef       			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Never'
								; 
  	value washhandsf        			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Never'
								; 
  	value needlereusef      			0= 'No'
				      			1= 'Yes' 
								2= 'Do not know'
								;	 
  	value syringereusef     			0= 'No'
								1= 'Yes'
								2= 'Do not know' 
								;
  	value proph24hourf      			0 = 'No'
								1 = 'Yes' 
								2 = 'Do not know'
								; 
  	value immhepbf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value immhepb_allf       			0= 'No'
	              	      			1= 'Yes' 
				      			;
  	value immtetanusf        			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value disposef           			1 = 'Always'
								2 = 'Sometimes' 
								3 = 'Rarely'
								4 = 'Never'
								; 
  	value traininjf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value trainexpf          			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value trainwheref        			1 = 'UTH'
								2 = 'Another hospital' 
								3 = 'Other'
								4 = 'A school'
				      			; 
  	value guidelinesf        			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value avoidf             			0= 'No'
	                        			1= 'Yes' 
				      			;
  	value prevhivhepf 				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value universalf  				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value medhivexpf  				0= 'No'
	                 					1= 'Yes' 
				     				;
  	value medhivexpavailf  				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivlowf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivworryf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hepworryf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value knowprevf        				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value knowalertf       				0= 'No'
	                      				1= 'Yes' 
				          			;
 	value bbfhivf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value bbfhepbf         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value bbfhepcf         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthivf           				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthepbf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sthepcf          				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value pchivf           				0 = 'No'
								1= 'Yes' 
								;
  	value pchepbf          				0 = 'No'
								1 = 'Yes'
								;  
  	value pchepcf          	  			0= 'No'
	                      				1= 'Yes' 
				          			;
  	value hivhealthyf      				0= 'No'
	                      				1= 'Yes' 
				          	 		;
  	value hivcuref         				0= 'No'
	                      				1= 'Yes' 
				          			;
  	value sharpcleanf         			0= 'No'
	                         			1= 'Yes' 
								2= 'Dont know'
				            		;
	value sharpbleachf        			0= 'No'
	                         			1= 'Yes'
	                         			2= 'Dont know' 
				            		;
	value sharpbloodf         			0= 'No'
	                         			1= 'Yes'
	                         			2= 'Dont know' 
				            		;
    value prophtimef 					1= 'Less than 2 hours' 
								2= 'Less than 24 hours' 
								3= 'Less than 72 hours' 
								4= 'Less than one week' 
								; 
proc import out=one
datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
DBMS=xlsx replace; 
getnames=yes; 
run; 
data one_new; 
	set one; 
	format 
	sex sexf. 
	occ occf.              
	Ptcare ptcaref.          		
	shift shiftf.            					           		
	specialty specialtyf.        		
	dept deptf.              	
	loc locf. 		      		
	**bleep** prickf.          		
	sharp sharpsf.         		
	sharpsyr sharpsyrf.        		
	injrecap injrecapf.       		
	injwaste injwastef.       		
	injsut injsutf.         		
	injdraw injdrawf.        		
	injiv injivf.          		
    	injsugar injsugarf.        		
	injvacc injvaccf.        		
	injor injorf.           		
	injsurg injsurgf.         		
	injclean injcleanf.        		
	injset injsetf.  	      	
    	splash splashf.        		
    	splashyr splashyrf.      		
    	splashoccur splashoccurf.   	 	
	worry worryf.         		
    	washsoap washsoapf.      		
    	washiodalc washiodalcf.    		
    	squeeze squeezef.      		
  	pressure pressuref.            	
  	alert alertf.               	
  	testhiv testhivf.             	
  	testhepb testhepbf.            	
  	testhepc testhepcf.            
  	proph prophf.               
  	tetanus tetanusf.             	
  	checkpth checkpthf.            	                      			
  	checkpthehepb checkpthepbf.         	
  	checkpthepc checkpthepcf.         	
  	responsena responsenaf.          	
  	alertno alertnof.             			
  	alerttime alerttimef.           	
  	alertperson alertpersonf.         	
  	prophtx prophtxf.       		
  	prophtneg prophtnegf.           	
  	prophptnohiv prophptnohivf.  		
  	prophlowrisk prophlowriskf.  		
  	prophneed prophneedf.     		 
  	prophhivfear prophhivfearf.  		
  	prophmeds prophmedsf.     		
  	prophout prophoutf.      		
  	prophna prophnaf.       		
  	hiv hivf.           		
  	hepb hepbf.          		
  	hepc hepcf.          		
  	needlerecap needlerecapf.   		
  	glovesdraw glovesdrawf.    		
  	glovesneedle glovesneedlef.  		
  	gloveprocedures gloveproceduresf.  		
  	glovedisposal glovedisposalf.   		
  	noglovesnotime noglovesnotimef.     	
  	noglovesmerg noglovesemergf.     	
  	noglovesunavail noglovesunavailf.   	
  	noglovescomfort noglovescomfortf.   	
  	noglovesdiff noglovesdifff.      	
  	noglovesnec noglovesnecf.       	
  	noglovesoth noglovesothf.       	
  	protective protectivef.        	 
  	washhands washhandsf.         	 
  	needlereuse needlereusef.       	 
  	syringereuse syringereusef.      	
  	proph24hour proph24hourf.       	 
  	immhepb immhepbf.           	
  	immhepb_all immhepb_allf.        	
  	immtetanus immtetanusf.         
  	dispose disposef.            	 
  	traininj traininjf.          	
  	trainexp trainexpf.           	
  	trainwhere trainwheref.         	 
  	guidelines guidelinesf.         	
  	avoid avoidf.              	
  	prevhivhep prevhivhepf.  		
  	universal universalf.   		
  	medhivexp medhivexpf.   		
  	medhivexpavail medhivexpavailf.   		
  	hivlow hivlowf.           		
  	hivworry hivworryf.         		
  	hepworry hepworryf.         		
  	knowprev knowprevf.         		
  	knowalert knowalertf.        		
 	bbfhiv bbfhivf.           		
  	bbfhepb bbfhepbf.          		
  	bbfhepc bbfhepcf.          		
  	sthiv sthivf.            		
  	sthepb sthepbf.           		
  	sthepc sthepcf.           			
  	pchiv pchivf.            		
  	pchepb pchepbf.           		 
  	pchepc pchepcf.           	  	
  	hivhealthy hivhealthyf.       		
  	hivcure hivcuref.          		
  	sharpclean sharpcleanf.          	
	sharpbleach sharpbleachf.         	
	sharpblood sharpbloodf.          	
    prophtime prophtimef. 
run;  
proc print data=one_new; 
run; 


The log for this code is here: 

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)
Licensed to BOSTON UNIVERSITY - SFA T&R, Site 70130214.
NOTE: This session is executing on the X64_10HOME platform.

 

NOTE: Updated analytical products:

SAS/STAT 14.3
SAS/ETS 14.3
SAS/OR 14.3
SAS/IML 14.3
SAS/QC 14.3

NOTE: Additional host information:

X64_10HOME WIN 10.0.17134 Workstation

NOTE: SAS initialization used:
real time 1.58 seconds
cpu time 1.31 seconds

NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.

1 proc format;
2 value sexf 1 = 'Female'
3 2 = 'Male'
4 ;
NOTE: Format SEXF has been output.
5 value occf 1 = 'Doctor'
6 2 = 'Medical student'
7 3 = 'Nurse midwife'
8 4 = 'Lab technician'
9 5 = 'Mortuary attendant'
10 6 = 'Clinical officer'
11 7 = 'Nurse'
12 8 = 'Nursing student'
13 9 = 'Housekeeper'
14 10 = 'Other'
15 11 = 'Dentist'
16 . = 'Missing'
17 ;
NOTE: Format OCCF has been output.
18 value ptcaref 1= 'Always'
19 2= 'Often'
20 3= 'Rarely'
21 4= 'Never'
22 ;
NOTE: Format PTCAREF has been output.
23 value shiftf 1='Day shift'
24 2='Evening/night shift'
25 3='Mixed shift (sometimes day, sometimes evening/night)'
26 ;
NOTE: Format SHIFTF has been output.
27 value specialtyf 1= 'Internal Medicine'
28 2= 'Pediatrics'
29 3= 'Anesthesiology'
30 4= 'Pathology'
31 5= 'Surgery'
32 6= 'Obstetrics/Gynecology'
33 7= 'Radiology'
34 8= 'Other'
35 ;
NOTE: Format SPECIALTYF has been output.
36 value deptf 1 = 'Medical Ward'
37 2 = 'Pediatric Ward'
38 3 = 'Operating Theatre'
39 4 = 'Dental Clinic'
40 5 = 'Surgical Ward'
41 6 = 'Ob/Gyn Ward'
42 7 = 'Emergency Ward'
43 8 = 'Dialysis clinic'
44 9 = 'Other'
45 10 = 'Intensive care unit'
46 11= 'Oncology Ward'
47 97= 'Not applicable (I work in many
48 locations)'
49 ;
NOTE: Format DEPTF has been output.
50 value locf 1 = 'Inpatient'
51 2 = 'Outpatient'
52 . = 'Missing'
53 ;
NOTE: Format LOCF has been output.
54 value prickf 0 = 'No'
55 1 = 'Yes'
56 ;
NOTE: Format PRICKF has been output.
57 value sharpsf 0 = 'No'
58 1= 'Yes'
59 ;
NOTE: Format SHARPSF has been output.
60 value sharpsyrf 0 = 'No'
61 1= 'Yes'
62 ;
NOTE: Format SHARPSYRF has been output.
63 value injrecapf 0 = 'No'
64 1 = 'Yes'
65 ;
NOTE: Format INJRECAPF has been output.
66 value injwastef 0 = 'No'
67 1 = 'Yes'
68 ;
NOTE: Format INJWASTEF has been output.
69 value injsutf 0 = 'No'
70 1 = 'Yes'
71 ;
NOTE: Format INJSUTF has been output.
72 value injdrawf 0 = 'No'
73 1 = 'Yes'
74 ;
NOTE: Format INJDRAWF has been output.
75 value injivf 0 = 'No'
76 1 = 'Yes'
77 ;
NOTE: Format INJIVF has been output.
78 value injsugarf 0 = 'No'
79 1 = 'Yes'
80 ;
NOTE: Format INJSUGARF has been output.
81 value injvaccf 0 = 'No'
82 1 = 'Yes'
83 ;
NOTE: Format INJVACCF has been output.
84 value injorf 0 = 'No'
85 1 = 'Yes'
86 ;
NOTE: Format INJORF has been output.
87 value injsurgf 0 = 'No'
88 1 = 'Yes'
89 ;
NOTE: Format INJSURGF has been output.
90 value injcleanf 0 = 'No'
91 1 = 'Yes'
92 ;
NOTE: Format INJCLEANF has been output.
93 value injsetf 1 = 'Hospital ward'
94 2 = 'Operating theatre'
95 3 = 'Emergency/casualty ward'
96 4 = 'Outpatient clinic'
97 5 = 'Laundry'
98 6 = 'Other'
99 7 = 'Mortuary'
100 8 = 'Hospital grounds'
101 ;
NOTE: Format INJSETF has been output.
102 value splashf 0 = 'No'
103 1 = 'Yes'
104 ;
NOTE: Format SPLASHF has been output.
105 value splashyrf 0 = 'No'
106 1 = 'Yes'
107 ;
NOTE: Format SPLASHYRF has been output.
108 value splashoccurf 1 = 'Hospital ward'
109 2 = 'Operating theatre'
110 3 = 'Emergency/casualty ward'
111 4 = 'Outpatient clinic'
112 5 = 'Laundry'
113 6 = 'Other'
114 ;
NOTE: Format SPLASHOCCURF has been output.
115 value worryf 1 = 'Worried'
116 2 = 'Not worried'
117 99 = 'Not applicable'
118 ;
NOTE: Format WORRYF has been output.
119 value washsoapf 0 = 'No'
120 1 = 'Yes'
121 ;
NOTE: Format WASHSOAPF has been output.
122 value washiodalcf 0 = 'No'
123 1 = 'Yes'
124 ;
NOTE: Format WASHIODALCF has been output.
125 value squeezef 0 = 'No'
126 1 = 'Yes'
127 ;
NOTE: Format SQUEEZEF has been output.
128 value pressuref 0 = 'No'
129 1 = 'Yes'
130 ;
NOTE: Format PRESSUREF has been output.
131 value alertf 0 = 'No'
132 1 = 'Yes'
133 ;
NOTE: Format ALERTF has been output.
134 value testhivf 0 = 'No'
135 1 = 'Yes'
136 ;
NOTE: Format TESTHIVF has been output.
137 value testhepbf 0 = 'No'
138 1 = 'Yes'
139 ;
NOTE: Format TESTHEPBF has been output.
140 value testhepcf 0 = 'No'
141 1 = 'Yes'
142 ;
NOTE: Format TESTHEPCF has been output.
143 value prophf 0 = 'No'
144 1 = 'Yes'
145 ;
NOTE: Format PROPHF has been output.
146 value tetanusf 0 = 'No'
147 1 = 'Yes'
148 ;
NOTE: Format TETANUSF has been output.
149 value checkpthf 0 = 'No'
150 1 = 'Yes'
151 ;
NOTE: Format CHECKPTHF has been output.
152 value checkpthepbf 0 = 'No'
153 1 = 'Yes'
154 ;
NOTE: Format CHECKPTHEPBF has been output.
155 value checkpthepcf 0 = 'No'
156 1 = 'Yes'
157 ;
NOTE: Format CHECKPTHEPCF has been output.
158 value responsenaf 0 = 'No'
159 1 = 'Yes'
160 ;
NOTE: Format RESPONSENAF has been output.
161 value alertnof 1 = 'Did not think it was important to my health'
162 2 = 'Did not know how to report the exposure'
163 3 = 'Did not have time'
164 4 = 'Worried that I would seem unprofessional or careless'
165 5 = 'Felt reporting would not change
166 outcome'
167 6 = 'No reporting system available'
168 7 = 'Other'
169 8 = 'Patient HIV nonreactive'
170 ;
NOTE: Format ALERTNOF has been output.
171 value alerttimef 1 = 'Less than 2 hours'
172 2 = 'Less than 24 hours'
173 3 = 'Less than 72 hours'
174 4 = 'Less than one week'
175 5 = 'Over one week'
176 6 = 'Other'
177 97 = 'Not applicable'
178 ;
NOTE: Format ALERTTIMEF has been output.
179 value alertpersonf 1 = 'Less than 2 hours'
180 2 = 'Less than 24 hours'
181 3 = 'Less than 72 hours'
182 4 = 'Less than one week'
183 5 = 'Over one week'
184 6 = 'Other'
185 97 = 'Not applicable'
186 ;
NOTE: Format ALERTPERSONF has been output.
187 value prophtxf 0 = 'No'
188 1 = 'Yes'
189 ;
NOTE: Format PROPHTXF has been output.
190 value prophtnegf 0 = 'No'
191 1 = 'Yes'
192 ;
NOTE: Format PROPHTNEGF has been output.
193 value prophptnohivf 0 = 'No'
194 1 = 'Yes'
195 ;
NOTE: Format PROPHPTNOHIVF has been output.
196 value prophlowriskf 0 = 'No'
197 1 = 'Yes'
198 ;
NOTE: Format PROPHLOWRISKF has been output.
199 value prophneedf 0 = 'No'
200 1 = 'Yes'
201 ;
NOTE: Format PROPHNEEDF has been output.
202 value prophsideefff 0 = 'No'
203 1 = 'Yes'
204 ;
NOTE: Format PROPHSIDEEFFF has been output.
205 value prophhivfearf 0 = 'No'
206 1 = 'Yes'
207 ;
NOTE: Format PROPHHIVFEARF has been output.
208 value prophmedsf 0 = 'No'
209 1 = 'Yes'
210 ;
NOTE: Format PROPHMEDSF has been output.
211 value prophoutf 0 = 'No'
212 1 = 'Yes'
213 ;
NOTE: Format PROPHOUTF has been output.
214 value prophnaf 0 = 'No'
215 1 = 'Yes'
216 ;
NOTE: Format PROPHNAF has been output.
217 value hivf 0 = 'No'
218 1 = 'Yes'
219 ;
NOTE: Format HIVF has been output.
220 value hepbf 0 = 'No'
221 1 = 'Yes'
222 ;
NOTE: Format HEPBF has been output.
223 value hepcf 0 = 'No'
224 1 = 'Yes'
225 ;
NOTE: Format HEPCF has been output.
226 value needlerecapf 0 = 'No'
227 1 = 'Yes'
228 ;
NOTE: Format NEEDLERECAPF has been output.
229 value glovesdrawf 1 = 'Always'
230 2 = 'Sometimes'
231 3 = 'Rarely'
232 4 = 'Never'
233 97 = 'Not applicable'
234 ;
NOTE: Format GLOVESDRAWF has been output.
235 value glovesneedlef 1 = 'Always'
236 2 = 'Sometimes'
237 3 = 'Rarely'
238 4 = 'Never'
239 97 = 'Not applicable'
240 ;
NOTE: Format GLOVESNEEDLEF has been output.
241 value gloveproceduresf 1 = 'Always'
242 2 = 'Sometimes'
243 3 = 'Rarely'
244 4 = 'Never'
245 97 = 'Not applicable'
246 ;
NOTE: Format GLOVEPROCEDURESF has been output.
247 value glovedisposalf 1 = 'Always'
248 2 = 'Sometimes'
249 3 = 'Rarely'
250 4 = 'Never'
251 97 = 'Not applicable'
252 ;
NOTE: Format GLOVEDISPOSALF has been output.
253 value noglovesnotimef 0 = 'No'
254 1 = 'Yes'
255 ;
NOTE: Format NOGLOVESNOTIMEF has been output.
256 value noglovesemergf 0 = 'No'
257 1 = 'Yes'
258 ;
NOTE: Format NOGLOVESEMERGF has been output.
259 value noglovesunavailf 0 = 'No'
260 1 = 'Yes'
261 ;
NOTE: Format NOGLOVESUNAVAILF has been output.
262 value noglovescomfortf 0 = 'No'
263 1 = 'Yes'
264 ;
NOTE: Format NOGLOVESCOMFORTF has been output.
265 value noglovesdifff 0 = 'No'
266 1 = 'Yes'
267 ;
NOTE: Format NOGLOVESDIFFF has been output.
268 value noglovesnecf 0 = 'No'
269 1 = 'Yes'
270 ;
NOTE: Format NOGLOVESNECF has been output.
271 value noglovesothf 0 = 'No'
272 1 = 'Yes'
273 ;
NOTE: Format NOGLOVESOTHF has been output.
274 value protectivef 1 = 'Always'
275 2 = 'Sometimes'
276 3 = 'Never'
277 ;
NOTE: Format PROTECTIVEF has been output.
278 value washhandsf 1 = 'Always'
279 2 = 'Sometimes'
280 3 = 'Never'
281 ;
NOTE: Format WASHHANDSF has been output.
282 value needlereusef 0= 'No'
283 1= 'Yes'
284 2= 'Do not know'
285 ;
NOTE: Format NEEDLEREUSEF has been output.
286 value syringereusef 0= 'No'
287 1= 'Yes'
288 2= 'Do not know'
289 ;
NOTE: Format SYRINGEREUSEF has been output.
290 value proph24hourf 0 = 'No'
291 1 = 'Yes'
292 2 = 'Do not know'
293 ;
NOTE: Format PROPH24HOURF has been output.
294 value immhepbf 0= 'No'
295 1= 'Yes'
296 ;
NOTE: Format IMMHEPBF has been output.
297 value immhepb_allf 0= 'No'
298 1= 'Yes'
299 ;
NOTE: Format IMMHEPB_ALLF has been output.
300 value immtetanusf 0= 'No'
301 1= 'Yes'
302 ;
NOTE: Format IMMTETANUSF has been output.
303 value disposef 1 = 'Always'
304 2 = 'Sometimes'
305 3 = 'Rarely'
306 4 = 'Never'
307 ;
NOTE: Format DISPOSEF has been output.
308 value traininjf 0= 'No'
309 1= 'Yes'
310 ;
NOTE: Format TRAININJF has been output.
311 value trainexpf 0= 'No'
312 1= 'Yes'
313 ;
NOTE: Format TRAINEXPF has been output.
314 value trainwheref 1 = 'UTH'
315 2 = 'Another hospital'
316 3 = 'Other'
317 4 = 'A school'
318 ;
NOTE: Format TRAINWHEREF has been output.
319 value guidelinesf 0= 'No'
320 1= 'Yes'
321 ;
NOTE: Format GUIDELINESF has been output.
322 value avoidf 0= 'No'
323 1= 'Yes'
324 ;
NOTE: Format AVOIDF has been output.
325 value prevhivhepf 0= 'No'
326 1= 'Yes'
327 ;
NOTE: Format PREVHIVHEPF has been output.
328 value universalf 0= 'No'
329 1= 'Yes'
330 ;
NOTE: Format UNIVERSALF has been output.
331 value medhivexpf 0= 'No'
332 1= 'Yes'
333 ;
NOTE: Format MEDHIVEXPF has been output.
334 value medhivexpavailf 0= 'No'
335 1= 'Yes'
336 ;
NOTE: Format MEDHIVEXPAVAILF has been output.
337 value hivlowf 0= 'No'
338 1= 'Yes'
339 ;
NOTE: Format HIVLOWF has been output.
340 value hivworryf 0= 'No'
341 1= 'Yes'
342 ;
NOTE: Format HIVWORRYF has been output.
343 value hepworryf 0= 'No'
344 1= 'Yes'
345 ;
NOTE: Format HEPWORRYF has been output.
346 value knowprevf 0= 'No'
347 1= 'Yes'
348 ;
NOTE: Format KNOWPREVF has been output.
349 value knowalertf 0= 'No'
350 1= 'Yes'
351 ;
NOTE: Format KNOWALERTF has been output.
352 value bbfhivf 0= 'No'
353 1= 'Yes'
354 ;
NOTE: Format BBFHIVF has been output.
355 value bbfhepbf 0= 'No'
356 1= 'Yes'
357 ;
NOTE: Format BBFHEPBF has been output.
358 value bbfhepcf 0= 'No'
359 1= 'Yes'
360 ;
NOTE: Format BBFHEPCF has been output.
361 value sthivf 0= 'No'
362 1= 'Yes'
363 ;
NOTE: Format STHIVF has been output.
364 value sthepbf 0= 'No'
365 1= 'Yes'
366 ;
NOTE: Format STHEPBF has been output.
367 value sthepcf 0= 'No'
368 1= 'Yes'
369 ;
NOTE: Format STHEPCF has been output.
370 value pchivf 0 = 'No'
371 1= 'Yes'
372 ;
NOTE: Format PCHIVF has been output.
373 value pchepbf 0 = 'No'
374 1 = 'Yes'
375 ;
NOTE: Format PCHEPBF has been output.
376 value pchepcf 0= 'No'
377 1= 'Yes'
378 ;
NOTE: Format PCHEPCF has been output.
379 value hivhealthyf 0= 'No'
380 1= 'Yes'
381 ;
NOTE: Format HIVHEALTHYF has been output.
382 value hivcuref 0= 'No'
383 1= 'Yes'
384 ;
NOTE: Format HIVCUREF has been output.
385 value sharpcleanf 0= 'No'
386 1= 'Yes'
387 2= 'Dont know'
388 ;
NOTE: Format SHARPCLEANF has been output.
389 value sharpbleachf 0= 'No'
390 1= 'Yes'
391 2= 'Dont know'
392 ;
NOTE: Format SHARPBLEACHF has been output.
393 value sharpbloodf 0= 'No'
394 1= 'Yes'
395 2= 'Dont know'
396 ;
NOTE: Format SHARPBLOODF has been output.
397 value prophtimef 1= 'Less than 2 hours'
398 2= 'Less than 24 hours'
399 3= 'Less than 72 hours'
400 4= 'Less than one week'
401 ;
NOTE: Format PROPHTIMEF has been output.

NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.31 seconds
cpu time 0.31 seconds


402 proc import out=one
403 datafile='C:\Users\jackz\Desktop\SAS\BBFE.xlsx'
404 DBMS=xlsx replace;
405 getnames=yes;
406 run;

ERROR: Physical file does not exist, C:\Users\jackz\Desktop\SAS\BBFE.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

 

The TLDR version of this post is that I cannot read in an Excel file in SAS, which was exported from an Access database. Why is that? Also, why is SAS reading the pathway as 'C:\Users\jackz\Desktop\SAS\BBFE' rather than 'C:\Users\jackz\Desktop\SAS\BBFE.xlsx'? 

 

Thanks again for all of your help. 

 


 

JackZ295
Pyrite | Level 9

Thanks! I'm confused by what you mean when you ask why I'm re-reading over the file each time. I thought I just did a proc import procedure. Then I created a new dataset from the dataset I created from the proc import procedure to apply the formats. 

 

I tried to import the Access file as is, but I ran into issues. Here is the code from my second attempt: 

 

libname BBFS 'C:\Users\jackz\Desktop\BBFE Study'; 
proc import out=BBFS.one
datafile='C:\Users\jackz\Desktop\BBFE Study\Pierre study 30Jan13.mdb' 
dbms=access replace; 
run; 

Here is the log with the errors: 

 

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)
Licensed to BOSTON UNIVERSITY - SFA T&R, Site 70130214.
NOTE: This session is executing on the X64_10HOME platform.

 

NOTE: Updated analytical products:

SAS/STAT 14.3
SAS/ETS 14.3
SAS/OR 14.3
SAS/IML 14.3
SAS/QC 14.3

NOTE: Additional host information:

X64_10HOME WIN 10.0.17134 Workstation

NOTE: SAS initialization used:
real time 1.51 seconds
cpu time 1.26 seconds

NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.

1 libname BBFS 'C:\Users\jackz\Desktop\BBFE Study';
NOTE: Libref BBFS was successfully assigned as follows:
Engine: V9
Physical Name: C:\Users\jackz\Desktop\BBFE Study

2 proc import out=BBFS.one
3 datafile='C:\Users\jackz\Desktop\BBFE Study\Pierre study 30Jan13.mdb'
4 dbms=mdb replace;
ERROR: DBMS type MDB not valid for import.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

5 run;


6 proc import out=BBFS.one
7 datafile='C:\Users\jackz\Desktop\BBFE Study\Pierre study 30Jan13.mdb'
8 dbms=access replace;
9 run;

ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.
ERROR: Connection Failed. See log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.26 seconds
cpu time 0.17 seconds

 

Do you know what went wrong? The log also shows my first attempt. I ran into similar issues when I first tried to import the Access file without converting it to Excel. That is why I converted the Access file into an Excel file first. 

 

Thanks again for all of your help. 

JackZ295
Pyrite | Level 9
Thanks! It turned out that it was because I had the Excel file open.
Tom
Super User Tom
Super User

What exactly is the path to your files? 

You have posted three paths and the one to the XLSX file looks different than the others.

'C:\Users\jackz\Desktop\SAS\BBFE.xlsx'

'C:\Users\jackz\Desktop\BBFE Study'

'C:\Users\jackz\Desktop\BBFE Study\Pierre study 30Jan13.mdb' 

Does the SAS sub-directory actually exist on your desktop? Perhaps it is really a sub direcotry of the study directory?

JackZ295
Pyrite | Level 9
Thanks! It turned out that it was just because my Excel file was open while I was trying to read it in.
ballardw
Super User

Hint: Use Windows explorer and find the actual folder with the data file(s) in question. The click in the address bar that shows the sequence of folder. Copy the text in the address bar and paste in the program for the path portion of a filename statement or file path.

 

Use of the Windows explorer alone may let you realize that you have a minor error in your path. It is also helpful with the copy/paste to find the cases where there may be two (or more) spaces between words in folder names.

JackZ295
Pyrite | Level 9

Thanks! It turned out that it was just because my Excel file was open while I was trying to read it in. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 11 replies
  • 2457 views
  • 4 likes
  • 5 in conversation