This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%macro embed(f); | |
%local p ref rc fid; | |
%let p = %sysfunc(findc(&f,/\:.)); | |
%if &p %then %let rc = %sysfunc(filename(ref, &f)); | |
%else %let ref = &f; | |
%let fid = %sysfunc(fopen(&ref)); | |
%if &fid>0 %then | |
%do %while(%sysfunc(fread(&fid))=0); | |
%let rc = %sysfunc(fget(&fid, line, 32767)); | |
&line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Run SAS", | |
"type": "shell", | |
"linux": { | |
"command": "<sas startup scriptZ>.sh", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%macro jbdw_create_folder(dname); | |
%* laver recurivet alle manglende mapper i en given sti; | |
%if %symexist(crdir)=0 %then %do; | |
%let crdir=; | |
*Erstatter \ med /; | |
%let dname = %sysfunc(translate(&dname,/,\)); | |
*makes it indifferent wheter or not you add / to the end of the string; | |
%let dname=%sysfunc(tranwrd(%sysfunc(cats(&dname,/)),//,/)); | |
%end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%macro CprToBirthdaySql(cprnr); | |
case | |
when 0 <= input(substr(&cprnr,8,1),?1.) <= 9 and | |
0 <= input(substr(&cprnr,9,1),?1.) <= 9 then | |
case | |
when input(substr(&cprnr,7,1),1.) in (5,6,7,8) and | |
input(substr(&cprnr,5,2),2.) > 58 then | |
mdy(input(substr(&cprnr,3,2),2.), | |
input(substr(&cprnr,1,2),2.), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data have; | |
infile cards dsd dlm=','; | |
attrib id format=$1.; | |
attrib start informat=datetime20. format=datetime20.; | |
attrib slut informat=datetime20. format=datetime20.; | |
input id start slut; | |
cards; | |
1, 01-may-2020 08:00:00, 01-may-2020 12:00:00 | |
1, 01-may-2020 09:00:00, 01-may-2020 10:00:00 | |
1, 01-may-2020 13:00:00, 01-may-2020 22:00:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%let _output=DimHelligdag; | |
proc datasets lib=DM_FL_HR nolist; | |
delete &_output; | |
run; | |
data &_output; | |
StartDato=intnx('year',today(),-6,'B'); | |
Slutdato=intnx('year',today(),3,'E'); | |
attrib &_OUTPUT1_col1_name length=&_OUTPUT1_col1_type&_OUTPUT1_col1_length; | |
do dato=StartDato to Slutdato; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc fcmp outlib=funk.function.funcs; | |
function isCpr(cpr $); | |
/* prxmatch (perl regular expresion) bruges til validering af cpr nummer. | |
*/ | |
if prxmatch("/(?:(?:31(?:0[13578]|1[02])|(?:30|29)(?:0[13-9]|1[0-2])|(?:0[1-9]|1[0-9]|2[0-8])(?:0[1-9]|1[0-2]))[0-9]{3}|290200[4-9]|2902(?:(?!00)[02468][048]|[13579][26])[0-3])[0-9]{3}/",cpr) then retur=1; | |
else retur=0; | |
return(retur); | |
endsub; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%macro getengine(libref); | |
%global ENGINE; | |
%let dsid=%sysfunc(open(sashelp.vlibnam(where=(libname="%upcase(&libref.)")),i)); | |
%if (&dsid ^= 0) %then %do; | |
%let engnum=%sysfunc(varnum(&dsid,ENGINE)); | |
%let rc=%sysfunc(fetch(&dsid)); | |
%let engine=%sysfunc(getvarc(&dsid,&engnum)); | |
&engine. | |
%let rc= %sysfunc(close(&dsid.)); | |
%end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%macro nobs(data=_last_); | |
%local dsid anobs whstmt counted rc; | |
%let DSID = %sysfunc(open(&DATA., IS)); | |
%if &DSID = 0 %then %do; | |
%put %sysfunc(sysmsg()); | |
%let counted = .; | |
%goto mexit; | |
%end; | |
%else %do; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
***********************************************************************; | |
* Projekt : macropg | |
* | |
* Program name : VarExist.sas | |
* | |
* Path : /Y/nyfls/Statistikprogrammer/Macroprg/varExists.sas | |
* | |
* Author : Rud Faden | |
* | |
* Date created : 2018-05-14 12:50 |
NewerOlder