hi.. am new to SAS, I need to insert a query(eg - select count(distict inc_no) from incident_table) into the table using Dataset.
Second thing is i need to fetch that column and run a proc sql, i mean i need an ouput(count - 60) for the query which has been inserted in the incident_table.
How can i acheive this, pls anyone help me. Thanks in advance.
Not sure about the purpose of this, perhaps you could clarify the underlying requirement?
But technically, just store the query in a char column in a table.
Then you can use call execute in a data step that reads that table.
Sorry for delay in respond, I have inserted a data in the table, fyr,
make
select count(make) from auto |
I need an output of the above query, how can i get it. thanks.
Look into CALL EXECUTE or DOSUBL
Reeza.. Call execute is not working for me. am new to SAS.. can yu pls share some example pgm..? pls check my code below..
proc sql;
select make from auto
where
make like 'selec%';
call execute (make);
run;
Thanks in advance..
Anyone pls help on my below query...
Call execute is not working for me. am new to SAS.. can yu pls share some example pgm..? pls check my code below..
proc sql;
select make from auto
where
make like 'selec%';
call execute ("PROC SQL;");
run;
Thanks in advance..
You don't need anything actually. Your question was confusing.
Submit the following program
Proc SQL;
select make
from auto
where make like 'selec%';
quit;
See here for basic SAS tutorials as well as links to the free ecourse.
Thanks for your respond. for your query am getting a result like,
make
select count(make) from auto group by mpg
there is a query in the variable as shown above, I have got an ouput from your query, what i want is, i need an output for the above query(select count(make) from auto group by mpg) from the variable.
It really helps to show some example data. If you have a data set then instructions here https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to create SAS datastep code that can be posted here as text so that we can recreate the intput data.
Then show what the desired result for that data.
You are starting in the middle and the desired output is not clear.
I'm sorry, but it's incredibly unclear on what you're trying to achieve. I can't tell if its a very basic question where you want to run a query and get results or if its something more complex where you're trying to store code in a data set and then execute said code.
Please post in more details what you're trying to do, and try and include examples/samples as much as possible.
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.