Hi,
I am getting an error and warning from a proc sql that seems to be rightly coded. Here is the code and my log. Any help is highly appreciated.
1. WARNING
proc sql;
create table prostate AS
select distinct PATIENT_ID
from ao.T01_P01_PROSTATE;
quit;
Here SAS is saying that the use of AS is misspelled. This is the warning in the log
167 proc sql;
168 create table prostate AS
___
1
WARNING 1-322: Assuming the symbol AS was misspelled as AS .
169 select distinct PATIENT_ID
170 from ao.T01_P01_PROSTATE;
NOTE: SAS threaded sort was used.
10 The SAS System Saturday, April 8, 2023 01:17:36 PM
NOTE: Table WORK.PROSTATE created, with 53509 rows and 1 columns.
171 quit;
NOTE: PROCEDURE SQL used (Total process time):
2. ERROR
proc sql;
create table prostate2 AS
select distinct prostate.PATIENT_ID, bio.lookup_dt, mri, bio.DT_DIAG_PRC, max(mri.lookup_dt) as mri_lookup_dt /*format=mmddyy10.*/
from prostate
left join mri on prostate.PATIENT_ID = mri.PATIENT_ID
left join bio on prostate.PATIENT_ID = bio.PATIENT_ID
where mri.lookup_dt <= bio.lookup_dt
group by prostate.PATIENT_ID, mri.PATIENT_ID, bio.PATIENT_ID;
quit;
LOG
173 proc sql;
174 create table prostate2 AS
___
1
WARNING 1-322: Assuming the symbol AS was misspelled as AS .
175 select distinct prostate.PATIENT_ID, bio.lookup_dt, mri, bio.DT_DIAG_PRC, max(mri.lookup_dt) as mri_lookup_dt format=mmddyy10.
176 from prostate
177 left join mri on prostate.PATIENT_ID = mri.PATIENT_ID
178 left join bio on prostate.PATIENT_ID = bio.PATIENT_ID
179 where mri.lookup_dt <= bio.lookup_dt
180 group by prostate.PATIENT_ID, mri.PATIENT_ID, bio.PATIENT_ID;
ERROR: The value 'PROSTATE 'n is not a valid SAS name.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
181 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
167 proc sql; 168 create table prostate AS ___ 1 WARNING 1-322: Assuming the symbol AS was misspelled as AS .
@CathyVI please from now on, paste the log files into the window that appears when you click on the </> icon, as I have done. This improves the formatting and readability of the log. Do this every single time from now on. Every single time.
The problem that SAS is indicating is most likely cause by an unprintable character appearing immediately before or after AS. How can that happen? Usually if the code has been copied from some other software or file format which is not a true text editor, such as MS Word, MS PowerPoint, MS Excel or even PDF files. The solution is to erase prostate AS and then re-type it manually.
167 proc sql; 168 create table prostate AS ___ 1 WARNING 1-322: Assuming the symbol AS was misspelled as AS .
@CathyVI please from now on, paste the log files into the window that appears when you click on the </> icon, as I have done. This improves the formatting and readability of the log. Do this every single time from now on. Every single time.
The problem that SAS is indicating is most likely cause by an unprintable character appearing immediately before or after AS. How can that happen? Usually if the code has been copied from some other software or file format which is not a true text editor, such as MS Word, MS PowerPoint, MS Excel or even PDF files. The solution is to erase prostate AS and then re-type it manually.
@PaigeMiller Thank you. I will always remember to put the code in the insert code.
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.