BookmarkSubscribeRSS Feed
Harish32
Calcite | Level 5

I want the following code to be converted to Teradata SQL. Please help. Thanks In advance.

data weight2;
input IDnumber $ Week1;
datalines;
2477 200
2477 295
2431 220
2431 150
2412 135
;

proc sort data=weight2;
by descending IDnumber ;
run;

data we;
set weight2 ;
by descending IDnumber;
if first.IDnumber then do;
y=0;
end;
y=Week1-y;
retain y;
run;

1 REPLY 1
LinusH
Tourmaline | Level 20

This is a SAS community, so Teradata knowledge can be limited.

The logic you show is not easy to directly convert to SQL, could be if Teradata have some specific functions/syntax for this.

You might be better off asking in a Teradata forum.

 

For slightly simpler queries, just use a Teradata libname, it will generate Teradata SQL on the fly (implicit SQL pass through).

 

Data never sleeps

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 562 views
  • 0 likes
  • 2 in conversation