Hi I have this code, but I am getting an error in SAS studio. Please help.
* import;
PROC IMPORT OUT= diag
DATAFILE= 'C:\Users\manya\Documents\Flatiron\Patient_Diagnosis.csv' DBMS=csv REPLACE;
GETNAMES=YES;
RUN;
PROC IMPORT OUT= tx
DATAFILE= 'C:\Users\manya\Documents\Flatiron\Patient_Treatment.csv REPLACE;
GETNAMES=YES;
RUN;
LOG
statements in the SAS Studio environment may disable some output features.
71
72 * import;
73 PROC IMPORT OUT= diag
74 DATAFILE= 'C:\Users\manya\Documents\Flatiron\Patient_Diagnosis.csv' DBMS=csv REPLACE;
75 GETNAMES=YES;
76 RUN;
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/C:\Users\manya\Documents\Flatiron\Patient_Diagnosis.csv.
ERROR: Import unsuccessful. See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.03 seconds
user cpu time 0.03 seconds
system cpu time 0.01 seconds
memory 9282.40k
OS Memory 36380.00k
Timestamp 03/26/2020 07:54:49 PM
Step Count 24 Switch Count 5
Page Faults 0
Page Reclaims 3060
Page Swaps 0
Voluntary Context Switches 44
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 64
77
78 PROC IMPORT OUT= tx
79 DATAFILE= '/home/users/jheo/Practice/Patient_Treatment.csv' DBMS=csv REPLACE;
80 GETNAMES=YES;
81 RUN;
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
ERROR: Physical file does not exist, /home/users/jheo/Practice/Patient_Treatment.csv.
ERROR: Import unsuccessful. See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.02 seconds
user cpu time 0.02 seconds
system cpu time 0.01 seconds
memory 8301.50k
OS Memory 36380.00k
Timestamp 03/26/2020 07:54:49 PM
Step Count 25 Switch Count 5
Page Faults 0
Page Reclaims 939
Page Swaps 0
Voluntary Context Switches 26
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
82
83
84 %macro countid(tb);
85 proc sql;
86 select "&tb." as title, count(patient_id) as obs, count(distinct patient_id) as pts
87 from &tb.;
88 quit;
89 %mend countid;
90 %countid(diag);
This error:
ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/C:\Users\manya\Documents\Flatiron\Patient_Diagnosis.csv. ERROR: Import unsuccessful. See SAS Log for details.
tells me that most likely you are connecting to a server to run SAS / SAS Studio. As such the path of the files you can access start on the server somewhere and that server cannot access your local hard drive. The path of the file is starting where the SAS application resides on the server.
Solutions involve putting the file where the server can see it, which may mean moving the file to a work space you have on the server, or using a task that uses different access methods than the basic Proc Import code. You may need to discuss with your SAS admin what the approach preferred is in your organization.
This error:
ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/C:\Users\manya\Documents\Flatiron\Patient_Diagnosis.csv. ERROR: Import unsuccessful. See SAS Log for details.
tells me that most likely you are connecting to a server to run SAS / SAS Studio. As such the path of the files you can access start on the server somewhere and that server cannot access your local hard drive. The path of the file is starting where the SAS application resides on the server.
Solutions involve putting the file where the server can see it, which may mean moving the file to a work space you have on the server, or using a task that uses different access methods than the basic Proc Import code. You may need to discuss with your SAS admin what the approach preferred is in your organization.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.