macro

  1. B

    KALPHA not working

    Hi Everyone, Would you please help me understand why SPSS says "The first word in the line is not recognised as an SPSS statistics command" even though I have installed and activated the Hayes kalpha macro? I would appreciate if you can suggest possible ways on how I can fix this or any other...
  2. C

    Inefficient SPSS Macro

    I have details relating to over 700,000 customer contacts. Our customers may use more than one address (e.g. home and business) and more than one telephone number (e.g. mobile or landline). It is also possible that there may be more than one name (e.g. mis-spelling) recorded for a particular...
  3. G

    Macro in SPSS to run AREG command on multiple variables (subjects) at one time?

    Hello! I am attempting to use the AREG command in SPSS to run a Cochrane-Orcutt transformation on multiple subjects at one time. My data file has about 80 participants. My syntax currently looks like this: /AREG Subject1 with Time /Method=CO /RHO=.9. The output of this syntax...
  4. N

    Macro question

    Hi, I'm a beginner in SPSS syntax/macro and i have a question for people that know how to use these tools. In order to save some time i would like to create some macro to be able to do some redundant test on different set of variables, using different filters etc ... Right now i can (with...
  5. B

    Multiple Mediation Model using INDIRECT Macro Vs. Amos - different results!

    Hi, I have a multiple mediation model with 1 IV, 6 mediators, and 1 DV (all are continuous variables). I also have one covariate to control for. I ran a mediation analysis using those variables (plus the covariate) using INDIRECT macro by Preacher & Hayes. Two of my partial mediations were...
  6. M

    Do Loop with IF in Macro

    Hi, I've been struggling with a do loop in SAS and would be grateful for any assistance. This is the data I have: data have; input Parameter $ COL1 $ COL2 $; cards; Intercept AGE DRINKPATTERN DRINKPATTERN AGE DRINKPATTERN DRINKPATTERN AGE DRINKPATTERN DRINKPATTERN AGE...
  7. J

    SPSS Macro or Looping Function

    Hi All, I am hoping to get some advice about a possible macro or looping expression that may save me some time here. I have 50 columns of data across 90,000 rows that stipulate product departments that each individual viewed during a specific web visit. Each column could take one of 72...
  8. S

    Finding Optimal Cutpoints for Continuous Covariates with Time-to-Event Outcomes

    I found this interesting article from MayoClinic, where they talked about a macro that finds a cut point for a continuous variable with a time to event outcome. Does anyone know where I can find this macro? Is there a macro repository that might have this macro? It is not available on the...
  9. Z

    SPSS matrix command will not run within macro

    Hi, Have a matrix command section embedded in a macro. The matrix commands run OK when not within the macro. But they are not executed when placed within a macro. Normally matrix programs should be alright within macros...
  10. A

    closest value into a macro variable

    Hi everyone, I have a numeric variable, lets call it 'times'. I have a macro variable 'myTime' defined to be some value, lets say 200. I would like to extract the closest value in 'times' to 'myTime' as a new macro variable 'closestTime'. Would anyone know how to modify the code below so it...
  11. S

    PROC SQL macro into an ARRAY

    I am trying to create a macro (&varlist) using proc sql ---> then putting the variable into the array item[3]. But I get the error "Too few variables defined for the dimension(s) specified for the array item" What's wrong here? Any help would be greatly appreciated. proc sql noprint...
  12. M

    Export certain datasets as csv from macro

    Hi I have a functioning macro that creates a list of datasets from a master file that is unique for each day. The datasets I create in the SAS macro therefore have the data added to them so they are easy to categorize. I would like to export some of the datasets as I create during the...
  13. M

    Create unique variable names in macro

    Hi I have a functioning macro running through daily datasets. The macro itself works as it should and I get the outputs I want. I would however like for SAS to save the files it generates as OUTPUTAdate OUTPUTBdate etc. I can do so using this: data&year&mon2&day2 and then substitute...
  14. J

    How can I write a macro to execute iterative regressions?

    Hi, I have a group of 10 exposure variables and a group of 10 outcome variables. I would like to write a macro to regress each outcome variable on each exposure variable (a total of 100 regressions) using GEE with logistic regression, but I am unsure of how to code this. Any help would be...
  15. A

    voiding data set merging problems when by-variable has different lengths.

    When merging 2 tables on a common by-variable you run the risk of having a different length on this (or these) by variable(s). If this is the case, SAS will casually inform you with the following warning: WARNING: Multiple lengths were specified for the BY variable mergevar by input data...
  16. A

    SAS Macro Variable Quoting

    I need help with macro variable quoting. I have a SAS macro variable that has a list of values separated by | as below. The values are gathered from a SAS Dataset. Proc Sql; Select Distinct Strip(Diseasename) into :Dlist Separated by '|' From Dis_List; Quit; %Put %Bquote(&DList)...
  17. L

    SAS Macro problem (ERROR 22-322)

    Hi all, I'm a new member and I need your help!!! I have the following macro %macro test ( lib, outfile, file,var, value=); OPTIONS NOTES SOURCE SOURCE2 MPRINT MLOGIC MERROR ; data &lib..&outfile; set data = &lib..&file; where &var="&value"; run; %mend test; but when I...
  18. M

    Using macro variable to create names for variables

    I want to make a string variable with a number of 0's (say 842 for example). This works: *Macro to make a string var of specified length; %macro zerofill(strname, strlength); length &strname $100.; %let strtemp=%eval(&strlength); %do %while (&strtemp>0); substr(&strname, &strtemp, 1)="0"; %let...
  19. L

    Shapley Value in SAS

    Hi! Does anyone know how to calculate Shapley Value in SAS ? I found a macro that does that, but I don't manage to use it correctly. Any tips would be greatly appreciated. /Lauren