I have a data set, the month variable:month is CHAR7. So there is only year and month, ,shown as this format 2015-11 2015-12 I need to change them into NOV2015, DEC2015. So firstly i need change it into SAS . I tried: date=input(month, date7.) or other time formate, but it doesnt work. As i need use conditional statement, so i dont want to separate them into year and month into to column, i hope they still stay in the same column.
... View more
Hi all, I am doing multiple linear regression using proc survreg and want to test interaction between stressors and gender. I want to know if my codes below are correct for the model 1 and model 2. I really appreciate any feedback. This was a list of variables I used for the analysis. Gen2_cat= gender (binary) ethnicity_group= ethnicity (4 categorical) maritalstatus_dummy=marital status (binary) nativity2=nativity (binary) COVID_ImpactOverall_new= continuous FAsocitalracism= continuous Socialstressors4= continuous materialstressors4 = continuous Age_BirthYear_Calculate= continuous miss_binary('1') = complete sample /*Model1: Interaction Stressors*Gender – Interaction Testing*/
proc surveyreg data=mental8 alpha=0.05; /*alpha-set alpha level*/
class gen2_cat (ref="0") ethnicity_group (ref="0") maritalstatus_dummy (ref="0") nativity2_cat (ref="0"); /*reference*/
model COVID_ImpactOverall_new= FAsocitalracism socialstressor4_v1 materialstressors4 FAsocitalracism*gen2_cat socialstressor4_v1*gen2_cat materialstressors4*gen2_cat Age_BirthYear_Calculate gen2_cat ethnicity_group maritalstatus_dummy nativity2_cat income_new_n edu5_cat_n/solution CLPARM STB ADJRSQ;/*CLPARM=display 95%CI*/
weight WEIGHTS_A7;
domain miss_binary('1');
run; The interaction between stressors and gender I got : FAsocitalracism*gen2_cat : p=0.3537 socialstressor4_v1*gen2_cat : p=0.015 materialstressors4*gen2_cat : p=0.486 Since interaction social stressor and gender was significant, I would like to stratify the model by gender. In this case, should I include all stressors or just social stressor in the stratified model? /*Model2: Stratified by Gender*/
proc surveyreg data=mental8 alpha=0.05; /*alpha-set alpha level*/
class gen2_cat (ref="0") ethnicity_group (ref="0") maritalstatus_dummy (ref="0") nativity2_cat (ref="0"); /*reference*/
model COVID_ImpactOverall_new= FAsocitalracism socialstressor4_v1 materialstressors4 Age_BirthYear_Calculate ethnicity_group maritalstatus_dummy
nativity2_cat income_new_n edu5_cat_n/solution CLPARM STB ADJRSQ;/*CLPARM=display 95%CI*/
weight WEIGHTS_A7;
domain miss_binary('1')*gen2_cat; /*stratify by gender*/
run; Also, I want to know how I can get predicted mean mental health by stressors (i.e., FAsocitalracism, socialstressor4, materialstressors4) for female and male in proc surveyreg and create a graph based on the results (like the graph I attached below). I would appreciate if you could help me with this! Thank you in advance! Looking forward to your response!!!
... View more
Importing several delimited text files (by pipe: |). actual lengths of fields can vary. Several character strings contain tabs and carriage return type characters, which is throwing out the INFILE. The records themselves appear on a single row in the file. Character strings are not surrounded by double quotes. Affected data is free form text fields, from copy-paste (emails and similar). Proc import was originally tried but even with guessingrows max it isn't processing the file correctly. a basic SAS dataset with INFILE DLM and the like also processes the file incorrectly. Eventually used SAS Enterprise Guide's inbuilt "Import" function. This does read the correct number of records. But also caused fields to be read in with odd positioning: field A becomes field B and so on. Any thoughts?
... View more
Hello,
I am struggling with controlling page breaks in proc report/ods PDF. I already did a post a few months ago (https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-suppress-table-splitting-in-ODS-PDF/m-p/907292#M26446), but I have not found a solution yet. First, I thought I will just use ods rtf with the keepn option, but that brings more problems than it solves. Now, I have just found a paper that kind of describes the problem from Stetz et al. "Controlling Page Breaks when using Proc Report" (https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://support.sas.com/resources/papers/proceedings-archive/SUGI95/Sugi-95-70%2520Stetz.pdf&ved=2ahUKEwjHib_10PuFAxUi_rsIHa0GA9oQFnoECBAQAw&usg=AOvVaw0Z1J0znhm8-SeB_Oxq4tBr). Unfortunately, the paper is quite short and I do not understand how the data in the example code is structured. My question is: Does anyone have further knowledge on using "line counting" to control page breaks with proc report? Or does anyone know other papers that talk about this issue?
@Cynthia_sas did you write the paper? And if so, have you got any tips for the page break control?
If anyone needs code examples I can provide code and data, but for now I thought it would be more useful if I try different approaches before just posting my code where I did not achieve much yet. I am grateful for any help.
Kind regards
... View more
I have a report (e.g. below) where a set of list controls control the data used in the scatter plot and a simple univariate linear regression. The table below has some reference x values, and the "Predicted" column is derived from the linear regression (right click on object, "Derive predicted", and included as an item in the dataset, avg. aggregation.) The linear regression itself updates whenever I select/deselect any item in the controls. But the 'Predicted' values are the values from the initial version of the regression from which I created the field. Is there any way to get the predicted y values from the regression updating dynamically and displayed in the report below? It should change whenever I change the list control selection. I just want the report viewer to be able to see the estimated y values at certain x values as they slice data in different combinations. Thank you!
... View more