mirror of
https://github.com/sasjs/core.git
synced 2026-01-03 23:50:06 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c41918c0a8 | ||
|
|
0361ca574d | ||
|
|
c75c169b80 | ||
|
|
eac47bd5db | ||
|
|
d302ef266d |
38
all.sas
38
all.sas
@@ -2478,16 +2478,16 @@ run;
|
|||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
select distinct lib into: liblist separated by ' ' from &inds;
|
select distinct lib into: liblist separated by ' ' from &inds;
|
||||||
%put &=liblist;
|
%put &=liblist;
|
||||||
%do i=1 %to %sysfunc(countw(&liblist));
|
%if %length(&liblist)>0 %then %do i=1 %to %sysfunc(countw(&liblist));
|
||||||
%let lib=%scan(&liblist,1);
|
%let lib=%scan(&liblist,1);
|
||||||
%let engine=%mf_getengine(&lib);
|
%let engine=%mf_getengine(&lib);
|
||||||
%if &engine ne V9 and &engine ne BASE %then %do;
|
%if &engine ne V9 and &engine ne BASE %then %do;
|
||||||
%let msg=&lib has &engine engine - formats cannot be applied;
|
%let msg=&lib has &engine engine - formats cannot be applied;
|
||||||
proc sql;
|
|
||||||
insert into &outds set lib="&lib",ds="_all_",var="_all", msg="&msg" ;
|
insert into &outds set lib="&lib",ds="_all_",var="_all", msg="&msg" ;
|
||||||
%if &errds=0 %then %put %str(ERR)OR: &msg;
|
%if &errds=0 %then %put %str(ERR)OR: &msg;
|
||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
|
quit;
|
||||||
|
|
||||||
%if %mf_nobs(&outds)>0 %then %return;
|
%if %mf_nobs(&outds)>0 %then %return;
|
||||||
|
|
||||||
@@ -5539,11 +5539,11 @@ filename &fref1 clear;
|
|||||||
|
|
||||||
@param ds The dataset from which to obtain column metadata
|
@param ds The dataset from which to obtain column metadata
|
||||||
@param outds= (work.cols) The output dataset to create. Sample data:
|
@param outds= (work.cols) The output dataset to create. Sample data:
|
||||||
|NAME $|LENGTH 8|VARNUM 8|LABEL $|FORMAT $49|TYPE $1 |DDTYPE $|
|
|NAME:$32.|LENGTH:best.|VARNUM:best.|LABEL:$256.|FMTNAME:$32.|FORMAT:$49.|TYPE:$1.|DDTYPE:$9.|
|
||||||
|---|---|---|---|---|---|---|
|
|---|---|---|---|---|---|---|---|
|
||||||
|AIR|8|2|international airline travel (thousands)|8.|N|NUMERIC|
|
|`AIR `|`8 `|`2 `|`international airline travel (thousands) `|` `|`8. `|`N `|`NUMERIC `|
|
||||||
|DATE|8|1|DATE|MONYY.|N|DATE|
|
|`DATE `|`8 `|`1 `|`DATE `|`MONYY `|`MONYY. `|`N `|`DATE `|
|
||||||
|REGION|3|3|REGION|$3.|C|CHARACTER|
|
|`REGION `|`3 `|`3 `|`REGION `|` `|`$3. `|`C `|`CHARACTER `|
|
||||||
|
|
||||||
<h4> Related Macros </h4>
|
<h4> Related Macros </h4>
|
||||||
@li mf_getvarlist.sas
|
@li mf_getvarlist.sas
|
||||||
@@ -5555,26 +5555,27 @@ filename &fref1 clear;
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
%macro mp_getcols(ds, outds=work.cols);
|
%macro mp_getcols(ds, outds=work.cols);
|
||||||
|
%local dropds;
|
||||||
proc contents noprint data=&ds
|
proc contents noprint data=&ds
|
||||||
out=_data_ (keep=name type length label varnum format:);
|
out=_data_ (keep=name type length label varnum format:);
|
||||||
run;
|
run;
|
||||||
data &outds(keep=name type length varnum format label ddtype);
|
%let dropds=&syslast;
|
||||||
set &syslast(rename=(format=format2 type=type2));
|
data &outds(keep=name type length varnum format label ddtype fmtname);
|
||||||
|
set &dropds(rename=(format=fmtname type=type2));
|
||||||
name=upcase(name);
|
name=upcase(name);
|
||||||
if type2=2 then do;
|
if type2=2 then do;
|
||||||
length format $49.;
|
length format $49.;
|
||||||
if format2='' then format=cats('$',length,'.');
|
if fmtname='' then format=cats('$',length,'.');
|
||||||
else if formatl=0 then format=cats(format2,'.');
|
else if formatl=0 then format=cats(fmtname,'.');
|
||||||
else format=cats(format2,formatl,'.');
|
else format=cats(fmtname,formatl,'.');
|
||||||
type='C';
|
type='C';
|
||||||
ddtype='CHARACTER';
|
ddtype='CHARACTER';
|
||||||
end;
|
end;
|
||||||
else do;
|
else do;
|
||||||
if format2='' then format=cats(length,'.');
|
if fmtname='' then format=cats(length,'.');
|
||||||
else if formatl=0 then format=cats(format2,'.');
|
else if formatl=0 then format=cats(fmtname,'.');
|
||||||
else if formatd=0 then format=cats(format2,formatl,'.');
|
else if formatd=0 then format=cats(fmtname,formatl,'.');
|
||||||
else format=cats(format2,formatl,'.',formatd);
|
else format=cats(fmtname,formatl,'.',formatd);
|
||||||
type='N';
|
type='N';
|
||||||
if format=:'DATETIME' or format=:'E8601DT' then ddtype='DATETIME';
|
if format=:'DATETIME' or format=:'E8601DT' then ddtype='DATETIME';
|
||||||
else if format=:'DATE' or format=:'DDMMYY' or format=:'MMDDYY'
|
else if format=:'DATE' or format=:'DDMMYY' or format=:'MMDDYY'
|
||||||
@@ -5586,7 +5587,8 @@ data &outds(keep=name type length varnum format label ddtype);
|
|||||||
end;
|
end;
|
||||||
if label='' then label=name;
|
if label='' then label=name;
|
||||||
run;
|
run;
|
||||||
|
proc sql;
|
||||||
|
drop table &dropds;
|
||||||
%mend mp_getcols;/**
|
%mend mp_getcols;/**
|
||||||
@file mp_getconstraints.sas
|
@file mp_getconstraints.sas
|
||||||
@brief Get constraint details at column level
|
@brief Get constraint details at column level
|
||||||
|
|||||||
@@ -142,16 +142,16 @@ run;
|
|||||||
proc sql noprint;
|
proc sql noprint;
|
||||||
select distinct lib into: liblist separated by ' ' from &inds;
|
select distinct lib into: liblist separated by ' ' from &inds;
|
||||||
%put &=liblist;
|
%put &=liblist;
|
||||||
%do i=1 %to %sysfunc(countw(&liblist));
|
%if %length(&liblist)>0 %then %do i=1 %to %sysfunc(countw(&liblist));
|
||||||
%let lib=%scan(&liblist,1);
|
%let lib=%scan(&liblist,1);
|
||||||
%let engine=%mf_getengine(&lib);
|
%let engine=%mf_getengine(&lib);
|
||||||
%if &engine ne V9 and &engine ne BASE %then %do;
|
%if &engine ne V9 and &engine ne BASE %then %do;
|
||||||
%let msg=&lib has &engine engine - formats cannot be applied;
|
%let msg=&lib has &engine engine - formats cannot be applied;
|
||||||
proc sql;
|
|
||||||
insert into &outds set lib="&lib",ds="_all_",var="_all", msg="&msg" ;
|
insert into &outds set lib="&lib",ds="_all_",var="_all", msg="&msg" ;
|
||||||
%if &errds=0 %then %put %str(ERR)OR: &msg;
|
%if &errds=0 %then %put %str(ERR)OR: &msg;
|
||||||
%end;
|
%end;
|
||||||
%end;
|
%end;
|
||||||
|
quit;
|
||||||
|
|
||||||
%if %mf_nobs(&outds)>0 %then %return;
|
%if %mf_nobs(&outds)>0 %then %return;
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
|
|
||||||
@param ds The dataset from which to obtain column metadata
|
@param ds The dataset from which to obtain column metadata
|
||||||
@param outds= (work.cols) The output dataset to create. Sample data:
|
@param outds= (work.cols) The output dataset to create. Sample data:
|
||||||
|NAME $|LENGTH 8|VARNUM 8|LABEL $|FORMAT $49|TYPE $1 |DDTYPE $|
|
|NAME:$32.|LENGTH:best.|VARNUM:best.|LABEL:$256.|FMTNAME:$32.|FORMAT:$49.|TYPE:$1.|DDTYPE:$9.|
|
||||||
|---|---|---|---|---|---|---|
|
|---|---|---|---|---|---|---|---|
|
||||||
|AIR|8|2|international airline travel (thousands)|8.|N|NUMERIC|
|
|`AIR `|`8 `|`2 `|`international airline travel (thousands) `|` `|`8. `|`N `|`NUMERIC `|
|
||||||
|DATE|8|1|DATE|MONYY.|N|DATE|
|
|`DATE `|`8 `|`1 `|`DATE `|`MONYY `|`MONYY. `|`N `|`DATE `|
|
||||||
|REGION|3|3|REGION|$3.|C|CHARACTER|
|
|`REGION `|`3 `|`3 `|`REGION `|` `|`$3. `|`C `|`CHARACTER `|
|
||||||
|
|
||||||
<h4> Related Macros </h4>
|
<h4> Related Macros </h4>
|
||||||
@li mf_getvarlist.sas
|
@li mf_getvarlist.sas
|
||||||
@@ -30,26 +30,27 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
%macro mp_getcols(ds, outds=work.cols);
|
%macro mp_getcols(ds, outds=work.cols);
|
||||||
|
%local dropds;
|
||||||
proc contents noprint data=&ds
|
proc contents noprint data=&ds
|
||||||
out=_data_ (keep=name type length label varnum format:);
|
out=_data_ (keep=name type length label varnum format:);
|
||||||
run;
|
run;
|
||||||
data &outds(keep=name type length varnum format label ddtype);
|
%let dropds=&syslast;
|
||||||
set &syslast(rename=(format=format2 type=type2));
|
data &outds(keep=name type length varnum format label ddtype fmtname);
|
||||||
|
set &dropds(rename=(format=fmtname type=type2));
|
||||||
name=upcase(name);
|
name=upcase(name);
|
||||||
if type2=2 then do;
|
if type2=2 then do;
|
||||||
length format $49.;
|
length format $49.;
|
||||||
if format2='' then format=cats('$',length,'.');
|
if fmtname='' then format=cats('$',length,'.');
|
||||||
else if formatl=0 then format=cats(format2,'.');
|
else if formatl=0 then format=cats(fmtname,'.');
|
||||||
else format=cats(format2,formatl,'.');
|
else format=cats(fmtname,formatl,'.');
|
||||||
type='C';
|
type='C';
|
||||||
ddtype='CHARACTER';
|
ddtype='CHARACTER';
|
||||||
end;
|
end;
|
||||||
else do;
|
else do;
|
||||||
if format2='' then format=cats(length,'.');
|
if fmtname='' then format=cats(length,'.');
|
||||||
else if formatl=0 then format=cats(format2,'.');
|
else if formatl=0 then format=cats(fmtname,'.');
|
||||||
else if formatd=0 then format=cats(format2,formatl,'.');
|
else if formatd=0 then format=cats(fmtname,formatl,'.');
|
||||||
else format=cats(format2,formatl,'.',formatd);
|
else format=cats(fmtname,formatl,'.',formatd);
|
||||||
type='N';
|
type='N';
|
||||||
if format=:'DATETIME' or format=:'E8601DT' then ddtype='DATETIME';
|
if format=:'DATETIME' or format=:'E8601DT' then ddtype='DATETIME';
|
||||||
else if format=:'DATE' or format=:'DDMMYY' or format=:'MMDDYY'
|
else if format=:'DATE' or format=:'DDMMYY' or format=:'MMDDYY'
|
||||||
@@ -61,5 +62,6 @@ data &outds(keep=name type length varnum format label ddtype);
|
|||||||
end;
|
end;
|
||||||
if label='' then label=name;
|
if label='' then label=name;
|
||||||
run;
|
run;
|
||||||
|
proc sql;
|
||||||
|
drop table &dropds;
|
||||||
%mend mp_getcols;
|
%mend mp_getcols;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@sasjs/core",
|
"name": "@sasjs/core",
|
||||||
"description": "Production Ready Macros for SAS Application Developers",
|
"description": "Macros for SAS Application Developers",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"SAS",
|
"SAS",
|
||||||
@@ -38,4 +38,4 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ts-loader": "^9.2.6"
|
"ts-loader": "^9.2.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,67 +1,73 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html
|
||||||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<!-- HTML header for doxygen 1.8.17-->
|
<!-- HTML header for doxygen 1.8.17-->
|
||||||
<html xmlns="https://www.w3.org/1999/xhtml" lang="en">
|
<html xmlns="https://www.w3.org/1999/xhtml" lang="en">
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=9" />
|
|
||||||
<meta property="og:type" content="website">
|
|
||||||
<meta name="author" content="Allan Bowe">
|
|
||||||
<meta name="generator" content="Doxygen $doxygenversion" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<!--BEGIN PROJECT_NAME-->
|
|
||||||
<meta name="description" content="$projectbrief" />
|
|
||||||
<!--END PROJECT_NAME-->
|
|
||||||
<!--BEGIN !PROJECT_NAME-->
|
|
||||||
<title>$title</title>
|
|
||||||
<!--END !PROJECT_NAME-->
|
|
||||||
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css" />
|
|
||||||
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
|
||||||
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
|
||||||
$treeview $search $mathjax
|
|
||||||
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
|
|
||||||
<link rel="shortcut icon" href="$relpath^favicon.ico" type="image/x-icon" />
|
|
||||||
$extrastylesheet
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="top">
|
|
||||||
<!-- do not remove this div, it is closed by doxygen! -->
|
|
||||||
|
|
||||||
<!--BEGIN TITLEAREA-->
|
<head>
|
||||||
<div id="titlearea">
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
|
||||||
<table cellspacing="0" cellpadding="0">
|
<meta http-equiv="X-UA-Compatible" content="IE=9" />
|
||||||
<tbody>
|
<meta property="og:type" content="website">
|
||||||
<tr style="height: 56px">
|
<meta property="og:title" content="MacroCore" />
|
||||||
<!--BEGIN PROJECT_LOGO-->
|
<meta property="og:url" content="https://core.sasjs.io" />
|
||||||
<td id="projectlogo">
|
<meta property="og:image" content="https://core.sasjs.io/Macro_core_website_1.png" />
|
||||||
<a href="$relpath^"
|
<meta name="author" content="Allan Bowe">
|
||||||
><img alt="Logo" src="$relpath^$projectlogo"
|
<meta name="generator" content="Doxygen $doxygenversion" />
|
||||||
/></a>
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
</td>
|
<!--BEGIN PROJECT_NAME-->
|
||||||
<!--END PROJECT_LOGO-->
|
<meta name="description" content="$projectbrief" />
|
||||||
<td id="projectalign" style="padding-left: 0.5em">
|
<meta name="og:description" content="$projectbrief" />
|
||||||
<div id="projectbrief">
|
<!--END PROJECT_NAME-->
|
||||||
Production Ready Macros for SAS Application Developers<br />
|
<!--BEGIN !PROJECT_NAME-->
|
||||||
<a href="https://github.com/sasjs/core">
|
<title>$title</title>
|
||||||
https://github.com/sasjs/core
|
<!--END !PROJECT_NAME-->
|
||||||
</a>
|
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css" />
|
||||||
</div>
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
</td>
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
</tr>
|
$treeview $search $mathjax
|
||||||
</table>
|
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
|
||||||
</td>
|
<link rel="shortcut icon" href="$relpath^favicon.ico" type="image/x-icon" />
|
||||||
|
$extrastylesheet
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="top">
|
||||||
|
<!-- do not remove this div, it is closed by doxygen! -->
|
||||||
|
|
||||||
|
<!--BEGIN TITLEAREA-->
|
||||||
|
<div id="titlearea">
|
||||||
|
<table cellspacing="0" cellpadding="0">
|
||||||
|
<tbody>
|
||||||
|
<tr style="height: 56px">
|
||||||
|
<!--BEGIN PROJECT_LOGO-->
|
||||||
|
<td id="projectlogo">
|
||||||
|
<a href="$relpath^"><img alt="Logo" src="$relpath^$projectlogo" /></a>
|
||||||
|
</td>
|
||||||
|
<!--END PROJECT_LOGO-->
|
||||||
|
<td id="projectalign" style="padding-left: 0.5em">
|
||||||
|
<div id="projectbrief">
|
||||||
|
Macros for SAS Application Developers<br />
|
||||||
|
<a href="https://github.com/sasjs/core">
|
||||||
|
https://github.com/sasjs/core
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<!--BEGIN DISABLE_INDEX-->
|
<!--BEGIN DISABLE_INDEX-->
|
||||||
<!--BEGIN SEARCHENGINE-->
|
<!--BEGIN SEARCHENGINE-->
|
||||||
<td>$searchbox</td>
|
<td>$searchbox</td>
|
||||||
<!--END SEARCHENGINE-->
|
<!--END SEARCHENGINE-->
|
||||||
<!--END DISABLE_INDEX-->
|
<!--END DISABLE_INDEX-->
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
<!--END TITLEAREA-->
|
|
||||||
<!-- end header part -->
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
<!--END TITLEAREA-->
|
||||||
</html>
|
<!-- end header part -->
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://cli.sasjs.io/sasjsconfig-schema.json",
|
"$schema": "https://raw.githubusercontent.com/sasjs/utils/main/src/types/sasjsconfig-schema.json",
|
||||||
"macroFolders": [
|
"macroFolders": [
|
||||||
"base",
|
"base",
|
||||||
"fcmp",
|
"fcmp",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
<h4> SAS Macros </h4>
|
<h4> SAS Macros </h4>
|
||||||
@li mp_getcols.sas
|
@li mp_getcols.sas
|
||||||
|
@li mp_assertcols.sas
|
||||||
@li mp_assertcolvals.sas
|
@li mp_assertcolvals.sas
|
||||||
@li mp_assertdsobs.sas
|
@li mp_assertdsobs.sas
|
||||||
|
|
||||||
@@ -30,4 +31,10 @@ run;
|
|||||||
checkvals=work.check.val,
|
checkvals=work.check.val,
|
||||||
desc=All values have a match,
|
desc=All values have a match,
|
||||||
test=ALLVALS
|
test=ALLVALS
|
||||||
|
)
|
||||||
|
|
||||||
|
%mp_assertcols(work.info,
|
||||||
|
cols=name type length varnum format label ddtype fmtname,
|
||||||
|
test=ALL,
|
||||||
|
desc=check all columns exist
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user