By Howard Schreier
In PROC SQL by way of instance: utilizing SQL inside SAS, writer Howard Schreier illustrates using PROC SQL within the context of the SAS info step and different SAS techniques (such as type, FREQ, capacity, precis, APPEND, DATASETS, and TRANSPOSE) whose performance overlaps and enhances that of SQL.
Using a side-by-side technique, this concise reference advisor comprises many greatly defined examples exhibiting identical info step and SQL code, allowing SAS clients to use present SAS abilities and information whereas studying approximately SQL. Discussions disguise the variations among SQL and the information step in addition to events the place SQL and the knowledge step are used jointly to profit from the strengths of each.
Topics addressed contain operating with joins and merges; utilizing subqueries; realizing set operators; utilizing the Macro Facility with PROC SQL; protecting tables; operating with perspectives; utilizing PROC SQL as a document generator; and more.
This textual content is perfect for SAS programmers trying to upload PROC SQL to their SAS toolkits in addition to SQL programmers striving to higher combine the SAS info step and SQL.
Read Online or Download PROC SQL by Example: Using SQL within SAS PDF
Best statistics books
Equipment and purposes of records in medical Trials, quantity 2: making plans, research, and Inferential tools comprises updates of tested literature from the Wiley Encyclopedia of scientific Trials in addition to unique fabric in accordance with the newest advancements in scientific trials. ready by way of a number one specialist, the second one quantity comprises a variety of contributions from present admired specialists within the box of scientific examine.
In past times decade there was an explosion in computation and knowledge know-how. With it have come giant quantities of knowledge in quite a few fields akin to medication, biology, finance, and advertising and marketing. The problem of knowing those info has ended in the improvement of latest instruments within the box of records, and spawned new parts corresponding to info mining, laptop studying, and bioinformatics.
Books in Barron's "Business evaluation sequence" are meant often for lecture room use. They make first-class supplementations to major texts whilst incorporated in college-level company classes. In grownup schooling and enterprise brush-up courses they could function major textbooks. All titles during this sequence comprise evaluation questions with solutions.
A few years in the past while I. assembled a few basic articles and lectures on likelihood and statistics, their e-book (Essays in likelihood and statistics, Methuen, London, 1962) bought a a few what greater reception than I were ended in anticipate of this type of miscellany. i'm hence tempted to chance publishing this moment assortment, the name i've got given it (taken from the 1st lecture) seeming to me to point a coherence in my articles which my publishers could rather be susceptible to question.
Extra info for PROC SQL by Example: Using SQL within SAS
In fact, even the AS clause providing the name for the new column could be omitted; an automatically generated (but not very meaningful) name would appear instead. The result, whether created in a DATA step or by PROC SQL, looks like Exhibit 2-3. 6 Aggregation We often need to derive summary statistics from our data. SAS provides a variety of methods for doing this. One of the most versatile is PROC SUMMARY. SQL does not have nearly the extent of functionality provided by a specialized tool like PROC SUMMARY, but it is an alternative for a lot of relatively simple tasks.
40 PROC SQL by Example: Using SQL within SAS Exhibit 3-3 SORTED FName Age Alice 13 Barbara 13 Jeffrey 13 Alfred 14 Carol 14 Henry 14 Judy 14 Janet 15 Mary 15 Ronald 15 William 15 Philip 16 Then we combine the original data with the counts, via a MERGE statement: DATA detail_and_counts; MERGE sorted cohorts; BY age; RUN; We now have all of the data together, but the names are grouped by AGE and thus not in alphabetical order, as we see in Exhibit 3-4. Chapter 3: More Building Blocks 41 Exhibit 3-4 DETAIL_AND_COUNTS (before sorting) FName Age Many Alice 13 3 Barbara 13 3 Jeffrey 13 3 Alfred 14 4 Carol 14 4 Henry 14 4 Judy 14 4 Janet 15 4 Mary 15 4 Ronald 15 4 William 15 4 Philip 16 1 So we sort again to restore the original alphabetical order: PROC SORT DATA=detail_and_counts; BY fname; run; Exhibit 3-5 reflects the result.
So, for example, we could compute, from TEENS, how large each age cohort is (that is, how many rows have AGE=13, how many have AGE=14, and so on). But such a summary table has one row for each value of AGE; in other words, it contains only the summary data. What if we need a row for each NAME, containing a combination of the data in the TEENS table and the cohort sizes? For example, we want to see a row for Barbara showing her name, her age (13), and the total number of 13-year-olds (3). Chapter 3: More Building Blocks 39 Avoiding (for now) SQL, we could begin by calling on PROC FREQ to get the cohort sizes.
PROC SQL by Example: Using SQL within SAS by Howard Schreier