With PROC SQL we can not only report data in Result window but we can also create New dataset for the result we get out of Select Query
WHY? - This is needed sometime because we want to reutilize the result of Select Query in some other places for analysis, so we required to store result somewhere in dataset.
HOW? - To perform this task we just need to write Create Table <Library.dataset Name> as Before any Select Statement
Syntax -
PROC SQL;
CREATE TABLE <Library.dataset name> AS
SELECT variable(s)
FROM Table Name
<WHERE Conditional statement
GROUP BY Variable(s)
ORDER BY variable(s)>;
QUIT;
See Example -
/* Creating Dataset using proc SQL */
Proc SQL;
Create Table WORK.AUDI as Select * From SASHELP.CARS
where Make = 'Audi';Run;
Use of INOBS option - Fix the number of rows in newly created dataset.
If you want to limit the number of observation(rows) in dataset produced by Proc SQL then INOBS option can be used -
0 Comments
If you have any doubt please comment or write us to - admin@datahark.com