Skip to content

Commit 1a0af7f

Browse files
committed
The SQLinDS package [ver. 2.3.2]
The SQLinDS package [ver. 2.3.2] Package regenerated with SAS Packages Framework, version 20250126. No functional changes, documentation cleaned up.
1 parent 64e0daa commit 1a0af7f

5 files changed

Lines changed: 267 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The package allows to write SQL queries in the data step, e.g.
1010
set %SQL(select name, age from sashelp.class order by age);
1111
run;
1212
```
13-
SHA256 digest for the latest version of `SQLinDS`: F*606A24A2A6B06DAAD2D443FA9A9819D9564235A5CD8599FD15586F1EFFCB41BC
13+
SHA256 digest for the latest version of `SQLinDS`: F*CEAA4C90515F6E8AACBFFD55ABA6544E399EDBE0A7081107B62DCEE6F5430A1D
1414

1515
[**Documentation for SQLinDS**](./sqlinds.md "Documentation for SQLinDS")
1616

hist/2.3.2/sqlinds.md

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
# Documentation for the `SQLinDS` package.
2+
3+
----------------------------------------------------------------
4+
5+
*SQL queries in Data Step*
6+
7+
----------------------------------------------------------------
8+
9+
### Version information:
10+
11+
- Package: SQLinDS
12+
- Version: 2.3.2
13+
- Generated: 2026-01-26T15:36:16
14+
- Author(s): Mike Rhoads ([email protected]), contributor Bartosz Jablonski
15+
- Maintainer(s): Bartosz Jablonski ([email protected])
16+
- License: MIT
17+
- File SHA256: `F*CEAA4C90515F6E8AACBFFD55ABA6544E399EDBE0A7081107B62DCEE6F5430A1D` for this version
18+
- Content SHA256: `C*BD9C8A88831541082BEFC07954D5CDB4A6827D1A7902B911221AC6FE712A087E` for this version
19+
20+
---
21+
22+
# The `SQLinDS` package, version: `2.3.2`;
23+
24+
---
25+
26+
27+
### The SQLinDS package [ver. 2.3.2]
28+
29+
The **SQLinDS** package is an implementation of
30+
the *macro-function-sandwich* concept introduced in the
31+
*"Use the Full Power of SAS in Your Function-Style Macros"*,
32+
the article by *Mike Rhoads (Westat, Rockville)*.
33+
34+
The article is available at:
35+
[https://support.sas.com/resources/papers/proceedings12/004-2012.pdf](https://support.sas.com/resources/papers/proceedings12/004-2012.pdf)
36+
37+
Copy of the article can also be found in *additional content* directory.
38+
39+
Package provides ability to *execute* SQL queries inside a data step, e.g.
40+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
41+
data class;
42+
set %SQL(select name, age from sashelp.class);
43+
run;
44+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
46+
See the help for the `%SQL()` macro to find more examples.
47+
48+
### Content ###################################################################
49+
50+
SQLinDS package contains the following components:
51+
52+
1. `%SQL()` macro - the main package macro available for the User
53+
2. `dsSQL()` function (internal)
54+
3. `%dsSQL_inner()` macro (internal)
55+
4. Library `DSSQL` (created as a subdirectory of the `WORK` library)
56+
5. Optional KMF-abbreviations `sqlinds`
57+
58+
---
59+
60+
61+
---
62+
63+
64+
---
65+
66+
Required SAS Components:
67+
- Base SAS Software
68+
69+
---
70+
71+
72+
---
73+
74+
Package contains additional content, run: `%loadPackageAddCnt(SQLinDS)` to load it
75+
or look for the `sqlinds_AdditionalContent` directory in the `packages` fileref
76+
localization (only if additional content was deployed during the installation process).
77+
78+
---------------------------------------------------------------------
79+
80+
*SAS package generated by SAS Package Framework, version `20260126`,*
81+
*under `WIN`(`X64_10PRO`) operating system,*
82+
*using SAS release: `9.04.01M9P06042025`.*
83+
84+
---------------------------------------------------------------------
85+
86+
# The `SQLinDS` package content
87+
The `SQLinDS` package consists of the following content:
88+
89+
1. [`dssql` libname ](#dssql-libname-1 )
90+
2. [`%dssql_inner()` macro ](#dssqlinner-macro-2 )
91+
3. [`%sql()` macro ](#sql-macro-3 )
92+
4. [`dssql()` function ](#dssql-function-4 )
93+
5. [`sqlinds` kmfsnip ](#sqlinds-kmfsnip-5 )
94+
95+
96+
6. [License note](#license)
97+
98+
---
99+
100+
## `dssql` libname <a name="dssql-libname-1"></a> ######
101+
102+
The `dsSQL` library stores temporary views
103+
generated during the `%SQL()` macro execution.
104+
105+
If possible a sub-directory of the `WORK` location is created, like:
106+
107+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
108+
LIBNAME dsSQL BASE "%sysfunc(pathname(WORK))/dsSQLtmp";
109+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110+
111+
if not possible, then redirects to the `WORK` location, like:
112+
113+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
114+
LIBNAME dsSQL BASE "%sysfunc(pathname(WORK))";
115+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116+
117+
---
118+
119+
120+
---
121+
122+
## `%dssql_inner()` macro <a name="dssqlinner-macro-2"></a> ######
123+
124+
The `%dsSQL_Inner()` macro is an **internal**
125+
macro called by `dsSQL()` function.
126+
127+
The macro generates a uniquely named SQL view on the fly
128+
which is then stored in the `dsSQL` library.
129+
130+
The `%dsSQL_Inner()` is *not* designed to be
131+
called on its own.
132+
133+
Recommended for *SAS 9.3* and higher.
134+
135+
---
136+
137+
138+
---
139+
140+
## `%sql()` macro <a name="sql-macro-3"></a> ######
141+
142+
The `%SQL()` macro is the **main**
143+
macro in the package. The macro allows
144+
to use SQL queries in the data step.
145+
146+
Recommended for *SAS 9.3* and higher.
147+
148+
Implementation is based on the article:
149+
*"Use the Full Power of SAS in Your Function-Style Macros"*
150+
by *Mike Rhoads* (Westat, Rockville), available at:
151+
[https://support.sas.com/resources/papers/proceedings12/004-2012.pdf](https://support.sas.com/resources/papers/proceedings12/004-2012.pdf)
152+
153+
Copy of the article can also be found in *additional content* directory.
154+
155+
### SYNTAX: ###################################################################
156+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
157+
%sql(<nonempty Proc SQL query code>)
158+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159+
160+
The THE query code is limited to approximately *32000* bytes.
161+
162+
### EXAMPLES: #################################################################
163+
164+
**EXAMPLE 1**: simple SQL query
165+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
166+
data class_subset;
167+
set %SQL(select name, sex, height from sashelp.class where age > 12);
168+
run;
169+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
170+
171+
**EXAMPLE 2**: query with dataset options
172+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
173+
data renamed;
174+
set %SQL(select name, age from sashelp.class
175+
where sex = "F")(rename = (age=age2)
176+
);
177+
run;
178+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179+
180+
**EXAMPLE 3**: Proc SQL dictionaries in the data step
181+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
182+
data dictionary;
183+
set %SQL(select dict.* from dictionary.macros as dict);
184+
run;
185+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186+
---
187+
188+
189+
---
190+
191+
## `dssql()` function <a name="dssql-function-4"></a> ######
192+
193+
The `dsSQL()` function is an **internal**
194+
function called by the `%SQL()` macro.
195+
196+
The function pass a query code from the `%SQL()`
197+
macro to the `%dsSQL_Inner()` internal macro.
198+
199+
The `dsSQL()` is *not* designed to be
200+
called on its own.
201+
202+
Recommended for *SAS 9.3* and higher.
203+
204+
### SYNTAX: ###################################################################
205+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
206+
dsSQL(unique_index_2, query)
207+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208+
209+
**Arguments description**:
210+
211+
1. `unique_index_2` - *Numeric*, internal variable, a unique index for views.
212+
213+
2. `query` - *Character*, internal variable, contains query text.
214+
215+
---
216+
217+
218+
---
219+
220+
## `sqlinds` kmfsnip <a name="sqlinds-kmfsnip-5"></a> ######
221+
This is a help note for `sqlinds` KMF-abbreviation.
222+
223+
The snippet presents a template
224+
for use of the `%SQL()` macro.
225+
226+
To read help info about the macro
227+
run he following:
228+
`%helpPackage(SQLinDS,'%sql()')`
229+
230+
231+
---
232+
233+
234+
---
235+
236+
# License <a name="license"></a> ######
237+
238+
Copyright (c) 2012 Mike Rhoads
239+
240+
Permission is hereby granted, free of charge, to any person obtaining a copy
241+
of this software and associated documentation files (the "Software"), to deal
242+
in the Software without restriction, including without limitation the rights
243+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
244+
copies of the Software, and to permit persons to whom the Software is
245+
furnished to do so, subject to the following conditions:
246+
247+
The above copyright notice and this permission notice shall be included in all
248+
copies or substantial portions of the Software.
249+
250+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
251+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
252+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
253+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
254+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
255+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
256+
SOFTWARE.
257+
258+
---
259+

hist/2.3.2/sqlinds.zip

196 KB
Binary file not shown.

sqlinds.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
### Version information:
1010

1111
- Package: SQLinDS
12-
- Version: 2.3.1
13-
- Generated: 2025-11-22T12:47:32
12+
- Version: 2.3.2
13+
- Generated: 2026-01-26T15:36:16
1414
- Author(s): Mike Rhoads ([email protected]), contributor Bartosz Jablonski
1515
- Maintainer(s): Bartosz Jablonski ([email protected])
1616
- License: MIT
17-
- File SHA256: `F*606A24A2A6B06DAAD2D443FA9A9819D9564235A5CD8599FD15586F1EFFCB41BC` for this version
18-
- Content SHA256: `C*4CCCF31DA9D94E0EE2DA612724D395056B7BA07CB593C93947835BB8319B33EB` for this version
17+
- File SHA256: `F*CEAA4C90515F6E8AACBFFD55ABA6544E399EDBE0A7081107B62DCEE6F5430A1D` for this version
18+
- Content SHA256: `C*BD9C8A88831541082BEFC07954D5CDB4A6827D1A7902B911221AC6FE712A087E` for this version
1919

2020
---
2121

22-
# The `SQLinDS` package, version: `2.3.1`;
22+
# The `SQLinDS` package, version: `2.3.2`;
2323

2424
---
2525

2626

27-
### The SQLinDS package [ver. 2.3.1]
27+
### The SQLinDS package [ver. 2.3.2]
2828

2929
The **SQLinDS** package is an implementation of
3030
the *macro-function-sandwich* concept introduced in the
@@ -77,7 +77,7 @@ localization (only if additional content was deployed during the installation pr
7777

7878
---------------------------------------------------------------------
7979

80-
*SAS package generated by SAS Package Framework, version `20251122`,*
80+
*SAS package generated by SAS Package Framework, version `20260126`,*
8181
*under `WIN`(`X64_10PRO`) operating system,*
8282
*using SAS release: `9.04.01M9P06042025`.*
8383

sqlinds.zip

276 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)