BookmarkSubscribeRSS Feed
Abishekaa
Obsidian | Level 7

 

I saw this code posted in reply to an old post. Could someone please explain the sql steps here?

1) The meaning of Difference/COL1 statement?

2) The inner join with i= and j= statements?

 

proc sql;
select
     aCL.*,
     Difference/COL1 as diffStdErr label="Difference Std Err"
from
     aCL inner join
     aDiffT on i = input(RowName,4.) and j = input(_LABEL_, 4.);
quit

 FYI here is the post: Solved: How to get standard error of difference of ls-mean... - SAS Support Communities

 

2 REPLIES 2
Tom
Super User Tom
Super User

@Abishekaa wrote:

 

I saw this code posted in reply to an old post. Could someone please explain the sql steps here?

1) The meaning of Difference/COL1 statement?

2) The inner join with i= and j= statements?

 


1) That is a division operator.  The result of dividing those two variables will become the new variable diffStdErr .

2) Those are equality tests.  So (i = input(RowName,4.)) will be true when the result of converting the first 4 bytes of ROWNAME into a number is a value that matches the value of the variable named I.

SuCheeTay
SAS Employee
Difference/COL1 as diffStdErr label="Difference Std Err"

This is only a query and Difference/COL1 is a division expression and it's value will be displayed under the new column aliased as diffStdErr but the label= assigned a label so Difference Std Err will be in the column header of the query result. 

 

on i = input(RowName,4.) and j = input(_LABEL_, 4.)

The aCL and aDiffT are inner joined on the criteria based on values of column i= converted values of RowName and values of column j= converted values of _LABEL_.

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