I'm getting an error when trying to match patient id - not sure why since it is called Patient ID in the excel file but it is called memberno in the dataset I'm trying to link to so that it brings in those patients only who have the codes specified (error at the bottom):
proc import
datafile="&qr./Patient List for Flu Data Dive - PY 2021.xlsx"
dbms=xlsx
out=shp_flu
replace;
run;
proc sql;
create table flu
as select *
from x.personImmunization
where (cpt in
("90630" "90653" "90654" "90655" "90656" "90657" "90658" "90661" "90662" "90666" "90667" "90668" "90673" "90674" "90682" "90685" "90686" "90687" "90688" "90756"
"G0008" "Q2034" "Q2035" "Q2036" "Q2037" "Q2038" "Q2039"))
and sourceSystem="xxxx" and Date between "2020-08-01" and "2021-03-31";
quit;
/*get a list of the patients that are in the vaccination list so that we only select their proc codes*/
proc sql;
create table members
as select *
from x.personAttribution
where memberNo in (select patient_id from shp_flu);
quit;
22 GOPTIONS ACCESSIBLE;
23 proc sql;
24 create table members
25 as select distinct memberNo
26 from x.personAttribution
27 where memberNo in (select patient_id from shp_flu);
ERROR: The following columns were not found in the contributing tables: patient_id.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
28 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.13 seconds
cpu time 0.03 seconds
Check the proc content output of your XLSX file after imported and specifically the variable name.
If there were leading spaces sometimes it ends up as _patientID or maybe it was Patient_ID?
proc content data=shp_flu;
run;
If you still have issues, please post the results of the proc content here.
You may run into other issues - for example if one file has leading zeroes and the other doesn't or if one file has the variable as character rather than numeric.
@bhca60 wrote:
I'm getting an error when trying to match patient id - not sure why since it is called Patient ID in the excel file but it is called memberno in the dataset I'm trying to link to so that it brings in those patients only who have the codes specified (error at the bottom):
proc import
datafile="&qr./Patient List for Flu Data Dive - PY 2021.xlsx"
dbms=xlsx
out=shp_flu
replace;
run;
proc sql;
create table flu
as select *
from x.personImmunization
where (cpt in
("90630" "90653" "90654" "90655" "90656" "90657" "90658" "90661" "90662" "90666" "90667" "90668" "90673" "90674" "90682" "90685" "90686" "90687" "90688" "90756"
"G0008" "Q2034" "Q2035" "Q2036" "Q2037" "Q2038" "Q2039"))
and sourceSystem="xxxx" and Date between "2020-08-01" and "2021-03-31";
quit;
/*get a list of the patients that are in the vaccination list so that we only select their proc codes*/
proc sql;
create table members
as select *
from x.personAttribution
where memberNo in (select patient_id from shp_flu);
quit;
22 GOPTIONS ACCESSIBLE;
23 proc sql;
24 create table members
25 as select distinct memberNo
26 from x.personAttribution
27 where memberNo in (select patient_id from shp_flu);
ERROR: The following columns were not found in the contributing tables: patient_id.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
28 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.13 seconds
cpu time 0.03 seconds
THANK YOU!!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.