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

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
  • 1 reply
  • 583 views
  • 0 likes
  • 2 in conversation