Recently in the SAS Community Library: Your often contains the information you need, but not sequenced in the order required for processing. @SASJedi shows you how to properly sequence data so you can compare the data in one table to the data in another, conduct merges or joins and more.
Hello Experts,
My code is :
AnneeSemaine=compress(year(datepart (MaDate))||"-"||week(datepart(MaDate),'v'));
I have the value 2023-9, do you know please some easy option to get 2023-09?
My second line of code is :
Moisjour=compress(month(datepart (MaDate))||"-"||day(datepart(MaDate)));
I have the value 9-2, do you know please how to get the value 09-02 ?
Thank you for your help !
... View more
Hello everybody, I have a question about designing a discrete choice experiment. My design contains: 2 unlabeled alternatives (Alt 1 and Alt 2) 5 attributes (x1, x2, x3, x4, x5) with three levels (0 = underachieved, 1 = sufficient, 2 = overachieved) 1 cost-attribute (x6) with four levels (0 = 0, 1 = 1%, 2 = 2%, 3 = 3%) Interaction effects between each of the 5 attributes (x1 – x5) and the cost attribute (x6) Restriction to avoid comparing Alt 1 with better attributes and lower costs with an Alt 2 with worse attributes and higher costs (and vice versa) Following the book “Marketing Research Methods in SAS” by Warren Kuhfeld, I created the following code: %mktruns(3 3 3 3 3 4, interact=x1*x6 x2*x6 x3*x6 x4*x6 x5*x6);
%mktex(3 3 3 3 3 4, seed = 200, n=144, interact=x1*x6 x2*x6 x3*x6 x4*x6 x5*x6);
%macro res;
g1 = (x[1,1:5])[+]; * Attributes in alt 1;
g2 = (x[2,1:5])[+]; * Attributes in alt 2;
bad = bad + (g1 > g2 & x[1,6] < x[2,6]); * Better attributes in 1 and lower price in 1;
bad = bad + (g2 > g1 & x[2,6] < x[1,6]); * Better attributes in 2 and lower price in 2;
%mend;
%mktlab(data=design, int=f1-f2)
proc print; run;
%choiceff(data=final, model=class(X1-X6), nsets=72, maxiter=20, seed=200, flags=f1-f2, options=relative, restrictions=res, resvars=X1-X6, beta=zero);
proc print; by set; id set; run;
%mktblock(data=best, nalts=2, nblocks=8, seed=200, maxiter=20); The final results are as follows: Finally, I still have the following questions: Is it correct to use the %mktex macro with n = 144 and the %choiceff macro with nsets = 72? Unfortunately, I don't understand exactly how the recommended size of the kandidate set relates to the size of the choice sets. Is my design able to estimate all parameters? Thank you so much!!
... View more
How do i assign page number in to macro varibale ?
proc sort data=sashelp.class out=class; by age; where age in (12,13,14); run;
ods proclabel 'Report'; ods pdf startpage=yes;
/*I want to add page number variable into macro variable */ /*I want to reset pagenumber when ever new age starts in new page */ /*Basically I need two pagenumbers one is full in order, other one is by age */
proc report data=class contents='' headline nowindows;by age; columns name sex age height weight;
define name / display "Name"; define sex / display "Sex"; define age / group display "Age" ; define height / display "Height"; define weight / display "Weight"; ;
run; ods pdf close;
... View more
Hello, First time posting here , please forgive errors. My question is about linear mixed models with the standard specification: y=XB + Zu + e using Proc Mixed. See for instance the Wikipedia: https://en.wikipedia.org/wiki/Mixed_model Could someone please explain why SAS Proc Mixed does not output the B coefficients and their standard errors, like in a standard regression output of Proc Reg, for instance? The B parameter is a meaningful statistical quantity (identifiable parameter in the underlying statistical model), and testing it makes sense in many problems. I believe a maximum likelihood estimator should exist if you assume normal errors and normal distribution for the random effects. Please correct me if necessary. So why are doesn't SAS return corresponding estimates and standard errors for the components of B and let you do a Wald test, say by default? Is there a way to get them? Why does it only offer Type III ANOVA analyses? Are the "Estimate" and "Contrast" tests all you can get? I'm sure other people have wondered about this too. Any further explanation would help a lot. Thanks for your help. John
... View more