Creating Dataset using Proc SQL - WHY ? | HOW ?
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 -
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 -
See Example -
/* Create a dataset Contains top 10 Cheapest Audi */Proc SQL INOBS=10;Create Table Audi as Select * From SASHELP.CARSwhere Make = 'Audi'ORDER BY MSRP;Run;
Labels: About SAS, Datahark, PROC SQL SAS, SAS, SAS SQL, SQL




0 Comments:
Post a Comment
If you have any doubt please comment or write us to - datahark12@gmail.com
Subscribe to Post Comments [Atom]
<< Home