sysfunc | A sysadmin-oriented shell library
kandi X-RAY | sysfunc Summary
kandi X-RAY | sysfunc Summary
SysFunc is a shell library primarily intended for Unix sysadmins.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sysfunc
sysfunc Key Features
sysfunc Examples and Code Snippets
Community Discussions
Trending Discussions on sysfunc
QUESTION
%macro var_in_list(z);
proc contents data=&z. noprint out=cont(keep= name);
run;
proc sql noprint;
select Name into :VarList separated by ' '
from cont;
quit;
proc sql noprint;
select count(*) into :count from cont; quit;
%put &count.;
%put &VarList.;
%let a=;
%let finish=%sysfunc(countw(&VarList));
%do i = 1 %to &finish;
%put var_&i= %scan(&varlist., &i, " ");
%ordinal(var_&i);
%end;
/*%do j=1 %to &finish;*/
/* %ordinal(a_:);*/
/*%end;*/
%mend var_in_list;
...ANSWER
Answered 2021-May-20 at 16:53You are referencing a macro variable you never create. You don't really need any macro varaiable. You can just pass the results of the scan to the macro call.
QUESTION
I have a dataset A1 as below.
...ANSWER
Answered 2021-Apr-27 at 12:48Macro code is for generating code, not manipulating data.
It is not clear what you are trying to count, but you probably have no need to generate code. Just loop over an array to perform your testing.
QUESTION
I'm trying to adjust the reporting period between 1 month and 3 months (full quarter) based on time of the month. Based on the date below, I should be getting the period between 1/1 and 3/31, but I'm getting a logic error when I run the following code, any advice on how to fix it?
ERROR: Expected close parathesis after macro function invocation not found. ERROR: Required operator not found in expression: 0 ) ERROR: SKipping to next %END statement.
...ANSWER
Answered 2021-Apr-26 at 22:43A few more issues than I initially realized so listing all below but overall, you shouldn't be doing this in this manner. Use a data step and CALL SYMPUTX() to create the macro variable at the end instead - less buggy and infinitely easier to code.
EVERY function call in a macro requires the
%SYFUNC()
wrapped around it -INTNX()
,MOD()
,MONTH()
Missing semicolons (Line 2, 4, 7, 9)
%DO is spelled incorrectly (DOL)
I don't know what you would want here:
&obsdate_current_qtr_first_day
You have no macro variable shown with that name but you have two with each portion of the name? Did you want to concatenate those values?Functions used in macros should not have the parameters within quotes ('month' versus month)
Use the
options mprint;
when writing/developing macros so you can see the values in the log and get more information to help you debug the issues at hand.
QUESTION
I have this piece of code
...ANSWER
Answered 2021-Apr-22 at 12:48Just remove the unneeded complications. Also I assume you did not mean to reverse the logic of when the WHERE clause is generated.
QUESTION
Long story short, I need to compare two data sets (A
and B
). B
should be a copy of A
but on an Impala server. Everyday I am retrieving B
to SAS from the Impala server through a SQL pass-through.
I am writing a program that will be run everyday to make sure those two data sets match 1:1. However, I am struggling with numerical approximations (precision).
Here is an example of A:
ID value 01 0 02 5000 03 978908.69 04 109789503.12 05 49505954.92In order to make the comparison, I am concatenating the two columns in a conc
column and then I am comparing A
and B
.
ANSWER
Answered 2021-Feb-27 at 17:51I have no idea what your larger problem is but to answer the question at the end just convert the number to a string using BEST32. format and remove the last character when the resulting string contains a decimal point.
QUESTION
I have some problems with getting basic file information send to me in an email.
From various scripts on the internet I have ended up with the following macro which works for outputting the information I want.
...ANSWER
Answered 2021-Feb-15 at 18:48Calling all of those functions using %SYSFUNC() is just making it harder to to do what you want. Just call the functions in a data step instead so that you have an actual dataset with the files. Then you can use any of multiple methods to direct the list where ever you want, including sending an email.
I am pretty sure that FINFO() always returns character strings so make sure that the target variables are long enough for the value returned. Note that the information available from FINFO() depends on the operating system where SAS is running. So make sure the names you use are appropriate for your SAS session.
QUESTION
I have a directory of csv files, each with names that begin with the letter m and end with a number. There are twelve files - m6 to m17.
I'd like to read them in and process them as separate data sets. I've written two macros attempting to do so. Macro1 works. Macro2 breaks. I would prefer Macro2 if I can get it to work, to avoid unnecessary bits like my creation of %rawfiles, invocation of %sysfunc, etc.
Macro 1:
...ANSWER
Answered 2021-Jan-14 at 17:40Small typo here, you need to use an & in front of LAST not the %.
QUESTION
So I have this code I'm working on to validate dates
...ANSWER
Answered 2021-Jan-14 at 22:22Date constants...
QUESTION
In my SAS code I would like to refer to an existing folder based on the date value (LADE_DATUM) that I declare with a prompt. From this date I define LADE_JAHR and LADE_MONAT:
...ANSWER
Answered 2021-Jan-05 at 14:29Just tell %SYSFUNC()
you want the month number generated with the Z
format instead of the default best
format.
QUESTION
I'm trying to append a string macro variable to a data set name in SAS. I want to create datasets that read something like work.cps2020jan and work.cps2020feb. But that's not what I am getting. My code:
...ANSWER
Answered 2020-Dec-11 at 20:37&value
is returned as quoted by %qscan()
. Use %scan()
instead. Quoted macro variables can sometimes cause issues on resolution when they're used in this way. It's best to only quote them when needed, such as in a %put
statement that has a % sign within it.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sysfunc
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page