Using The SAS VS Code Extension to Check Prime Distribution
Recent Library Articles
Recently in the SAS Community Library: @RyanKing showcases features in the SAS Visual Studio Code extension, including data exploration using SAS, SQL and Python in one SAS notebook file.
Hi, I have created a summary report using proc report with 2 pages tables (page 2 and 3). I also have report background in the first page and technical notes in the forth page. This script outputs a total of 4 pages PDF report with ODS destination nicely with no issues when I run this program (.epg) from the Enterprise Guide 8.3.
However, when I schedule to run this program (saving as .sas) in SAS Management Console (9.4), it outputs 2 and 3rd pages data tables but does not write any text in 1 and 2 page with proc odstext or ODS TEXT.
Just wondering if SAS Management Console (i.e. to run program on a specific time) using .sas program can't output odxtext?
Sample odstext script that I am using:
Proc odstext;
p ' Source:'/ style=[color=blue fontsize=11.5pt fontfamily=Calibri fontweight=bold];
list;
item "^{style[fontstyle=italic] }Date Extraction: &Extraction" / style=[fontsize=11pt fontfamily=Calibri];
item "^{style[fontstyle=italic] }Some data accessed through a Microsoft Access interface." / style=[fontsize=11pt fontfamily=Calibri];
end;
run;
OR
ODS TEXT='^S={LEFTMARGIN=0.1in RIGHTMARGIN=0.1in}^{style[ fontsize=8pt] ^{style[fontweight=bold color=black]Footnotes: See technical section for details}';
Thanks
... View more
Hi, In my data, i have repeated measures from two waves and I used both fixed effects and random effects. I am getting risk estimates in opposite directions. I want to test which method is suitable for my data and I saw on internet and ChatGpt also suggested to use Hausman test but unfortunately I couldn't get much help on how to run/code it. Below is my code, and if anyone can see how to use Husman's test to decide which method to use. Fixed effects: proc logistic data=analysis1;
class newid sex(ref='1') age_dik region(ref='North') / param=ref;
model anxiety (event='1') = temperature sex age_dik region rain / selection=none;
strata newid;
run; Random effects: proc genmod data=analysis1 descending;
class sex(ref='1') age_dik region(ref='North') newid;
model anxiety (ref='0') = temperature sex age_dik region rain/ dist=bin link=logit type3;
estimate 'temperature' temperature 1 / exp;
repeated subject=newid / type=exch ;
run; Thank you for help!
... View more
Every morning when I wake up, I ask myself "How can I use DOSUBL today?" Okay ... not every morning ... But yesterday when I got to work, a colleague asked me if I could help him solve a problem. He has some code that joins several SAS data sets, and sometimes one variable doesn't exist in a data set, and then the join fails. I know the best solution is to figure out why this happens and then prevent it from happening further ... but it wasn't really my problem. My solution would be to add this missing numeric variable to a data set IF it is not already present, so that the next join would work. I know I could write a macro solution to this, but I decided to try a DOSUBL solution. This post isn't really a question ... but rather the result of this learning experience where I write some DOSUBL code that works in SQL, and maybe this solution is overcomplicated (as I said, I could have simply written a small macro without DOSUBL), but any suggestions are welcome.
Here is what I came up with.
%macro varexist(data=_LAST_,varname=,alias=);
/* Use in SQL to add a column named &varname (which is numeric) if it doesn't already exist in the data set */
/* If it does exist in the data set, just extract all existing variables */
%if %upcase(%superq(data)) = _LAST_ %then %let data = &SYSLAST;
%if &alias= %then %let word=_name_;
%else %let word=cats("&alias..",_name_);
%let rc =
%sysfunc(dosubl(%str(
proc transpose data=&DATA(obs=0) out=ExpandVarList_temp;
var _all_;
run;
proc sql noprint;
select &word
into :temp_varnames separated by "," from ExpandVarList_temp ;
drop table ExpandVarList_temp;
quit;
)));
%let varexist = %sysfunc(findw(%qupcase(&temp_varnames),%upcase(&varname),%str(,.)));
%put &=varexist;
%if not &varexist %then %let temp_varnames = %unquote(&temp_varnames%str(,. as )&varname);
&temp_varnames
%mend varexist;
Usage:
proc sql;
create table want as select %varexist(data=sashelp.class,varname=height)
from sashelp.class;
quit;
Usage 2:
proc sql;
create table want as select %varexist(data=sashelp.class,varname=bloodpressure)
from sashelp.class;
quit;
Usage 3 (in a join)
data iq;
length name $ 8;
name='Jane';
iq=150;
output;
name='Janet';
iq=144;
output;
run;
proc sql;
create table want as select
%varexist(data=sashelp.class,varname=bloodpressure,alias=a)
,b.iq
from sashelp.class as a left join iq as b
on a.name=b.name;
quit;
... View more
Hi all,
I've created some parameters to use as filter descriptions. I gave every parameter a 'current value' so that it shows the category (e.g. team) when the data is not filtered and it shows the team name when a selection has been made. But everytime I test the filter descriptions, the 'current value' gets deleted. So it will show empty again like in the picture below. What am I doing wrong?
Thanks in advance.
Tessa
... View more
I have a code base that synthesizes a zip code to a claims dataset with a county code. The zip data is from one dataset and the claims dataset has the fips/county code. I can provide samples of both. We have been running this for several years now without major issues. However, the time to run this job is taking around 10-11 days whereas in the past is was closer to 6. I believe there to be changes to the environment, but I unfortunately cannot affect those changes. So I have to work around them. This is likely a big ask, but I was wondering if there was a possibility of optimizing the code for a potentially better production experience (shortened run time and QC). I am attaching a zip file of the code, data, and format in a zip file that I hope has all of the information. I realize this is a big ask of anyone, I'm just kind of stuck trying to figure out if there is a better way.
... View more