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_.

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