Recent Activity
I'm wondering if the very specific thing I'm trying to do is possible; there's other ways to solve this (see below) so it's more a question of efficiency than anything. For background, this is to be part of a macro that writes partial data step statements, so I have one absolute requirement: no step boundaries. With that in mind, I'm trying to efficiently get a list of variables on some dataset, with the kicker that this dataset can ideally be affected by clauses such as dataset(drop=...). Here's a toy macro to illustrate: %MACRO LIST_VARS(dataset);
%let dsid = %sysfunc(open(&dataset));
%let vars = ;
%do i = 1 %to %sysfunc(attrn(&dsid, nvar));
%let vars = &vars %sysfunc(varname(&dsid, &i));
%end; %let dsid = %sysfunc(close(&dsid));
&vars
%MEND;
/* Example use -- no clauses, no issue. */
%put %LIST_VARS(sashelp.class);
* Name Sex Age Height Weight ; The problem is that if you include drop= or keep= clauses, the number of variables will be affected but their variable number will not: /* Three variables retained: Name (#1), nAtBat (#3), and nAssts (#20) */
%put %LIST_VARS(sashelp.baseball(keep=na:));
* WARNING: Argument 2 to function VARNAME is out of range. ; /* Fires for varname(2) */
* Name nAtBat ; /* Note: no nAssts */ Specifically, while I'd assume the three variables can be retrieved as varname(1, 2, 3) they actually still occupy numbers 1, 3, 20 in this dataset as can be checked via PROC CONTENTS: proc contents data=sashelp.baseball(keep=na:) varnum;
quit;
* # Variable ;
* 1 Name ;
* 3 nAtBat ;
* 20 nAssts ; This creates a bit of a catch-22: to get these varnum I'd need the varname, and to get the varname I need the varnum. It is a brute-force option to keep incrementing variable numbers within varname until nvar (3) non-missing names are returned, but that isn't exactly elegant and will result in a bunch of warnings which I'd rather avoid. So, my question: is there any way to do this, i.e. how to efficiently figure out in this example that it's variables 1, 3, and 20 that were retained, in macro language? --- To be sure, I've already worked around this issue in the following ways: (i) implement drop/keep functionality in pure macro (i.e. read the full variable list and subset manually) but I'd rather also support dataset clauses, and (ii) dump the clauses into a side-session view via %sysfunc(dosubl) to then process that, but that causes quite some performance overhead. The same would hold for running e.g. PROC CONTENTS in a side session. A third option could be to first read in the full dataset, get all variables, and then handle the clauses separately, but that would also require a lot of housekeeping and manual processing. Surely there is some quick function or trick that I'm missing?
... View more

0
1
Hello, guys
You suggestion is precious.
To estimate the sample size, we need a value of R^2. I don't know how do we get that R^2.
An example script is:
proc power;
coxreg
hazardratio = 1.6
rsquare = 0.2
stddev = 1.1
power = 0.9
eventstotal = .
;
run;
The definition of R^2 is:
... View more

0
0
Hi I am working on an alternative logistic regression model with repeated measures The drug is the unit of analysis, and there are TWO levels of clustering—within patient, and patient within MD My dataset looks like this (My dataset contains approximately 15000 rows) data drugs; input patient MD Gender Age drug $ indication outcome; datalines; 1 1 2 54 a 1 1 1 1 2 54 b 1 1 1 1 2 54 c 0 0 2 4 1 41 a 1 0 2 4 1 41 c 1 0 2 4 1 41 e 1 1 3 1 1 24 h 0 0 4 5 2 29 c 1 0 5 1 2 72 a 1 1 5 1 2 72 a 0 1 6 2 2 72 i 0 1 6 2 2 72 b 0 0 7 1 1 36 a 0 0 8 3 1 25 a 0 1 ; PROC GENMOD DATA= drugs; CLASS MD PATIENT gender(ref="1") indication(ref="1"); MODEL outcome (event='1')= gender indication age / DIST=BIN ; REPEATED SUBJECT= PATIENT / TYPE=EXCH ; RUN ; What is wrong with my model? Thank you very much for your help
... View more

0
0
I suggest adding capabilities in SAS Visual Investigator to configure workflow tasks dialog box. In particular, adding a possibility to hide the Open Diagram button, considering that it shows a workflow complete picture, information that could be considered sensitive.
... View more

See more ideas labeled with:
0
2
Hi Everyone, i was attempting to run a score code in SAS Studio. but got the error that the mco_binary_caslib did not exist.
Hence i tried assigning the caslib as shown below
%let mco_binary_caslib = "Analytics_Project_XXXXXXXXX";
caslib "&mco_binary_caslib" datasource=(srctype="path") path="/sasdata/projects/text-XXXXXXXX" ;
but this gives the error that the projects path is part of the deny list. The above code will run if i run with elevated priviliges because it seems the denylist is not applicable for admins. My question is - Is there any way to assign the caslib without admin priviliges ? Or am i missing some step. I am not a regular SAS Viya user hence any suggestions you can give is highly appreciated. Viya 3.5 SAS Studio V
... View more

0
1
Unanswered topics
These topics from the past 30 days have no replies. Can you help?
Subject | Likes | Author | Latest Post |
---|---|---|---|
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
5 |