Show us, in the form of a data step with sample data, both the BEFORE and AFTER datasets. Help us help you.
Assuming you are talking about collapsing multiple observations into a single observation and not just removing some embedded line break characters in a character value on one observation, then the answer is No.
Why would you want to use PROC SQL for this?
data want ;
do until (last.orderno);
set have ;
by id date orderno line_order ;
length full_result $1000 ;
full_result=catx(' ',full_result,result);
end;
drop result ;
rename line_order = number_of_lines ;
run;
Hi @BrianC
Welcome to the community!
I don't think such a function is available in PROC SQL for now:
As you mention, it will be easier using a data step.
Could you please explain why this option is the only one for you?
Best,
@BrianC wrote:
Thank you for the rapid responses!
The reason for sql is that the database is stored on teradata (over 30 mil obs) and so far every attempt to run a data step has taken so long that I have had to stop it. Proc sql (and sql in teradata studio) runs much more efficiently/faster. I am new to working with such large files and so if you have insight on how to work more efficiently with a data step over a teradata server, I am all for it. I am open to any solution that gets this done, efficiently! Thank you all again!
That is a different question, one that could be answered on a Teradata discussion forum.
Just use pass-thru SQL to run whatever Teradata code you want. Will have the advantage of only returning to SAS the set of data you need.
proc sql;
connect to teradata ..... ;
create table want as select * from connection to teradata
( ... put your Teradata code that uses Windowing Functions
or Common Table Expressios (with keyword)
or Recursion
or other features that Teradata SQL supports
...
);
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.