proc sql;
create table laps_full as
select A.*, B.ref_desc
from laps As A
left join reason_ref as B
on (B.ref_code = A.rsn_cd
and A.src_app_cd = B.src_type_code)
;
quit;
can someone please help me understand why I get the error. I checked the view with alias B and all the columns are present in that view.
The SAS log isn't usually wrong with that regard. Can you show a proc contents output from each table?
Makes sure to look at the names and labels. And the actual log.
proc contents data=laps;
run;
proc contents data=reason_ref;
run;
@mith123 wrote:
proc sql;
create table laps_full as
select A.*, B.ref_descfrom laps As A
left join reason_ref as B
on (B.ref_code = A.rsn_cd
and A.src_app_cd = B.src_type_code)
;
quit;
can someone please help me understand why I get the error. I checked the view with alias B and all the columns are present in that view.
@mith123 wrote:
proc sql;
create table laps_full as
select A.*, B.ref_descfrom laps As A
left join reason_ref as B
on (B.ref_code = A.rsn_cd
and A.src_app_cd = B.src_type_code)
;
quit;
can someone please help me understand why I get the error. I checked the view with alias B and all the columns are present in that view.
How did you "check the view"? Did you use it as source in a data step, or open it in a table viewer?
The view code itself is not a measure. You can successfully define a SQL view although variables are not present in the source table(s).
You need to check all tables used in the view.
when you use proc contents and look at the table you will see that SAS has label names and variable names separately but linked. So, you might be using the label name that caused the error.
Columns? Do you mean variables?
View? Is the dataset referenced a B a VIEW?
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.