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

 

Hello. I am new too SAS. I am trying to combine the two tables below to include The domains from the Domains table that are equivalent to the question numbers that are on both tables. I keep getting the error below which says the the columns do not exist when I look at the tables I am pretty sure I am labeling them correctly? Any help would be appreciated. Thanks.


%LET A = A; TITLE "FINAL FORM"; PROC SQL; CREATE TABLE FINAL_FORM_&A AS SELECT Student, Results&A.QuestionNum, Scores, Domains_Form&A.DomainNum, Form FROM Results&A INNER JOIN Domains_Form&A ON Results&A.QuestionNum = Domains_Form&A.DomainNum; QUIT; PROC PRINT DATA=FINAL_FORM_&A; RUN;

ERROR: The following columns were not found in the contributing tables: Domains_FormADomainNum, ResultsAQuestionNum.



AAAAA.PNGAAAAAAA.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star
When referring to a macro variable, end the reference with a dot. Since the SQL syntax also needs a dot between the table name and the field name, use two dots:

ON Results

View solution in original post

3 REPLIES 3
Astounding
PROC Star
When referring to a macro variable, end the reference with a dot. Since the SQL syntax also needs a dot between the table name and the field name, use two dots:

ON Results
Astounding
PROC Star
ON Results&A..QuestionNum =
Domain_form&A..DomainNum

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 3 replies
  • 3321 views
  • 0 likes
  • 2 in conversation