SAS data sets do not usually contain SQL code, they usually contain data. Are you sure that is the requirement? SAS data sets would be a poor choice for a place to store code. Could it be that the requirement is to read SQL code into a SAS program?
@Banu wrote:
This is part of one of the automation. Users will give me one query, and I will need to break that query into all possible queries using where clause column /conditions to verify which query throwing 0 records.
Ex:
Query1: select * from emp where sal>5000;
Query2: select * from emp where sal>5000 and deptno=30;
Once I make the diff queries based on the input query, will submit queries to find whether all queries populating data or not.
As part of this, first I want to read the query into a single column in SAS Dataset.
Reading text from a file is trivial.
Making sense of it as SQL syntax is difficult.
One restriction is that character variables can only store 32K bytes. So your will have a limit on how large a block of code you can put into a single variable.
data want;
infile 'codefile' truncover ;
input codeline $32767.;
run;
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.