Kick-start Your Data Exploration Journey with SAS Information Catalog
Recent Library Articles
Recently in the SAS Community Library: @smanoj introduces you to the SAS Information Catalog, which provides a powerful search engine to find needed data assets.
When I tried to run proc mi for the following imputation, I noticed that the order of variables in regression model and in the var statement affects the imputed values. I want to understand what proc mi data=WIDEDAT seed=93538001 nimpute=50 out=OUTMI noprint minimum=0 maximum=14 minmaxiter=600 ; by TRT01PN; class CSIRSTR ; fcs nbiter=50 reg(BASE = CSIRSTR); fcs nbiter=50 reg(W2 = CSIRSTR BASE); /** Imputing missing mDSD values at W2**/ fcs nbiter=50 reg(W4 = CSIRSTR BASE W2); /**Imputing missing mDSD values at W4 **/ fcs nbiter=50 reg(W8 = CSIRSTR BASE W2 W4); /**Imputing missing mDSD values at W8 **/ fcs nbiter=50 reg(W12 = CSIRSTR BASE W2 W4 W8); /** Imputing missing mDSD values at W12 **/ fcs nbiter=50 reg(W16 = CSIRSTR BASE W2 W4 W8 W12); /** Imputing missing mDSD values at W16 **/ fcs nbiter=50 reg(W20 = CSIRSTR BASE W2 W4 W8 W12 W16); /** Imputing missing mDSD values at W20 **/ fcs nbiter=50 reg(W24 = CSIRSTR BASE W2 W4 W8 W12 W16 W20); /** Imputing missing mDSD values at W24 **/ var CSIRSTR BASE W2 W4 W8 W12 W16 W20 W24; run;
... View more
more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Here's the deal. I am getting this error when trying to run this code in SAS... proc sql; connect to odbc(dsn=example ); create table work.visit as select * from connection to odbc (SELECT * FROM Tbl_Visit); disconnect from odbc; quit; I have also tried to read the table interactively and get the same error message. The thing is this is code that has been used countless times on the same data set and it ran perfectly up until about a month ago. Also, there is batch programming we use that reads in all of the tables from this "example" database and they all read in fine with the exception of this one table. Does anyone have an idea what could have happened in the last month to that specific table that would cause this? There have been approximately 25 entries made to the table since the last time it worked properly.
... View more
Edit: Seems to be caused by this, as found by PaigeMiller below: https://support.sas.com/kb/66/896.html Hello, I am trying to get the median height of each person/ID (they all have multiple height measurements over time). I want to merge this median for each ID back into the dataset so I have the median height for each patient across their multiple records. This is my code: proc sql;
create table get_median_heights as
select *, median(height) as median_height
from height_records
group by ID;
quit; But this does not seem to be giving the median per person/ID, for example here is a toy example of one of the results I get: ID height median_height 001 67 69 001 . 69 001 67 69 001 67 69 001 . 69 002 64 60 002 65 60 002 65 60 002 65 60 003 . . 003 70 . 003 70 . 003 70 . 003 . . 003 70 . 003 70 . 003 . . 003 70 . 003 . . Why is ID 001 returning 69 instead of 67 and 002 is returning 60 instead of 65? And why is 003 returning as missing? I could have sworn this code used to work (I wrote it years ago), did something change with the behavior?
... View more
I have a program with a list of strings delimited by "|" that I want to look up in a string variable column. I'm getting some odd behavior that I don't understand. Below is a code example: data birds;
/* list of words */
all_the_words = 'BIRD|DOG|CAT';
length word_from_list $100.;
/* pull the first word from all_the_words */
do i = 1 to 1;
word_from_list = strip(scan(all_the_words, i, '|'));
end;
put "word_from_list: " word_from_list;
/* assert that word_from_list is the same */
words_the_same = (word_from_list = "BIRD");
/* text in which we look up BIRD */
text_for_lookup = "BIRD (text here)";
/* find results for word_from_list */
found_it = find(text_for_lookup, word_from_list);
/* find results for literal "BIRD" */
found_it_2 = find(text_for_lookup, "BIRD");
run; I'm finding that despite words_the_same being 1, I'm getting different results for found_it and found_it_2. Attached is the output dataset from this code run. I'm curious why these give different results and how to make it so that word_from_list gets found.
... View more
Hello,
I am trying to calculate age-adjusted mortality rates for a region using the code below:
proc stdrate data = traumadeaths refdata = ncipop method = direct stat = rate(mult = 100) ; population event = died total = population ; reference total = population; strata agegrp /stats; by edayr; ods output stdrate = MorRates stRatastats=tester; Run;
I am getting an error message:
ERROR: The observation values for the TOTAL= variable in the POPULATION statement must be positive.
Can anyone please explain to me what does this error mean?
Thank you 🙂
... View more