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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2452 views
  • 0 likes
  • 2 in conversation