BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

Could you please guide me understand what each code does? can I understand that technically both the codes are selecting the variables from DB2 table?

 

select distinct createdbylogonuserid, left(trim(lastname))||' '||left(trim(firstname)) as creator, creator_duser
from connection to db2(
select 	b.identifier as ......

Another one is,

 

select * from connection to db2(
select x.policyinstanceid , x.customerID, y.value as client_segment

 

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

What do you want explained, it seems to be as basic as it gets.  First one is creating a distinct list of strings with the two parts and a space.  The second selects from variables.

Babloo
Rhodochrosite | Level 12

In first code, connect to db2 statement comes after the selection of variables whereas in other code, connect to db2 statement comes before selection of variables

RW9
Diamond | Level 26 RW9
Diamond | Level 26

They are much the same, you can use either, refer to the documentation:

http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001348730.htm

 

You can only select from in the these mostly, and possibly insert into, but for other operations you will want a third type of syntax which is: execute by db (...);

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

One thing that is difference is that the first code selects a users list of variables and the second code selects all variables in the table.

while the 2 codes may provide the same information, it is hard to tell with not sample data tables for this code.

another difference is the enter selection which is incomplete in the sample are different. 

These 2 codes may provide the same results but user beware.

 

Know your data, we were given no data to evaluate.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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