Recently in the SAS Community Library: SAS' @Sundaresh1 highlights a sometimes overlooked task when applying document embeddings for purposes of similarity-based search. Normalisation of vectors helps obtain relevant matches.
I'm trying to create a summary output table of frequencies. I have 4 different subgroups between TM and ADRD (0,0; 1,0; 0,1; 1,1) and I'm trying to line them up horizontally rather than vertically. This is what I have:
TM_group
ADRD_group
Table
Value_Labels
WgtFreq
Percent
0
0
Table DEM_AGE
2:Age Group [65,75)
48301097
56.025
0
0
Table DEM_AGE
3:Age Group >=75
37912485
43.975
0
0
Table DEM_SEX
1:Male
36957033
42.867
0
0
Table DEM_SEX
2:Female
49256549
57.133
0
1
Table DEM_AGE
2:Age Group [65,75)
983069
26.877
0
1
Table DEM_AGE
3:Age Group >=75
2674626
73.123
0
1
Table DEM_SEX
1:Male
1363336
37.273
0
1
Table DEM_SEX
2:Female
2294360
62.727
1
0
Table DEM_AGE
2:Age Group [65,75)
82517247
60.176
1
0
Table DEM_AGE
3:Age Group >=75
54609890
39.824
1
0
Table DEM_SEX
1:Male
63773136
46.507
1
0
Table DEM_SEX
2:Female
73354000
53.493
1
1
Table DEM_AGE
2:Age Group [65,75)
1290895
25.83
1
1
Table DEM_AGE
3:Age Group >=75
3706852
74.171
1
1
Table DEM_SEX
1:Male
2215172
44.323
1
1
Table DEM_SEX
2:Female
2782576
55.677
And this is what I want:
no TM, no ADRD
no TM, ADRD
TM, no ADRD
TM, ADRD
Table
Value_Labels
WgtFreq
Percent
WgtFreq
Percent
WgtFreq
Percent
WgtFreq
Percent
Table DEM_AGE
2:Age Group [65,75)
48301097
56.025
983069
26.8767
82517247
60.1757
1290895
25.8295
Table DEM_AGE
3:Age Group >=75
37912485
43.975
2674626
73.1233
54609890
39.8243
3706852
74.1705
Table DEM_SEX
1:Male
36957033
42.867
1363336
37.2731
63773136
46.5066
2215172
44.3234
Table DEM_SEX
2:Female
49256549
57.133
2294360
62.7269
73354000
53.4934
2782576
55.6766
I think Proc Transpose could be used here, if I could get it to work correctly. Another idea I thought of is to separate each group into its own datafile, and then to add the columns from the second file to the right of the columns in the first file, and then repeat for the 3rd and 4th files. But I don't know how to add the columns like that.
Here is code to create the dataset above
data have;
infile datalines dsd dlm=',' truncover;
input TM_group ADRD_group Table Value_Labels WgtFreq Percent;
datalines;
0,0,Table DEM_AGE,2:Age Group [65,75),48301097,56.0249
0,0,Table DEM_AGE,3:Age Group >=75,37912485,43.9751
0,0,Table DEM_SEX,1:Male,36957033,42.8668
0,0,Table DEM_SEX,2:Female,49256549,57.1332
0,1,Table DEM_AGE,2:Age Group [65,75),983069,26.8767
0,1,Table DEM_AGE,3:Age Group >=75,2674626,73.1233
0,1,Table DEM_SEX,1:Male,1363336,37.2731
0,1,Table DEM_SEX,2:Female,2294360,62.7269
1,0,Table DEM_AGE,2:Age Group [65,75),82517247,60.1757
1,0,Table DEM_AGE,3:Age Group >=75,54609890,39.8243
1,0,Table DEM_SEX,1:Male,63773136,46.5066
1,0,Table DEM_SEX,2:Female,73354000,53.4934
1,1,Table DEM_AGE,2:Age Group [65,75),1290895,25.8295
1,1,Table DEM_AGE,3:Age Group >=75,3706852,74.1705
1,1,Table DEM_SEX,1:Male,2215172,44.3234
1,1,Table DEM_SEX,2:Female,2782576,55.6766
; RUN;
... View more
Hello, I ran a linear mixed model with repeated measures using PROC MIXED. I used the RCORR statement to obtain the intraclass correlation coefficient (ICC) for the non-independent variable 'score' across readers. Is there a function within PROC MIXED that outputs the 95% CI and p-value for the ICC? PROC MIXED DATA=final COVTEST;
CLASS subject_id reader (REF='1');
MODEL score = reader / S CL;
REPEATED / SUBJECT=subject_id TYPE=cs R RCORR;
RUN; Thank you for your help!
... View more
There should be an option to visualize data from two different tables into a single plot without having the need to join those tables. It should work by just mapping the connection between the two table. Why not join? Because join may create issues if the data is at a different hierarchy/ granularity level.
... View more
I'm conducting an analysis on SAS 9.4 with health insurance enrollment data and want to understand the enrollment patterns before and after a diagnosis. I have monthly data for several years which I want to select 24 rolling months based around a diagnosis date. I want to copy over the select months into new columns based on the start month range. I have a dummy example below where month1-month7 are the enrollment months 1 through 7 and start_month is the number of the start month and end _month is the number of the end month of the range. I want to copy the data into the "next" variables for a range of 4. Adding "output" into the code doesn't solve the issue. The desired output at the end of this code. Thank you! *table creation for 2 examples; data try1; input month1-month7 start_month end_month; datalines; 1 2 3 4 5 6 7 2 4 1 2 3 4 5 6 7 4 7 ; run; proc print data=try1; run; *This straight copies the data into the "next" variables, not based on start/end range; data try2; set try1; array month month1-month7; /*enrollment months*/ array next next1-next4; /*want to copy over select months here*/ do i=1 to 4; /*interested in range of 4 months*/ next{i}=month{i}; /*this straight copies the data*/ end; run; proc print data=try2; run; *HERE IS WHERE I AM STUCK; *Trying to copy the select months based on the start and end range; *This code below only copies the last select month, which is wrong; data try3; set try1; array month month1-month7; /*enrollment months*/ array next next1-next4; /*want to copy over select months here*/ do k=start_month to end_month; /*start month and end month for each person*/ do i=1 to 4; /*interested in range of 4 months*/ next{i}=month{k}; /*this code is incorrect, it just copies the last month */ end; end; run; proc print data=try3; run; /*This is the desired output*/ data want; input month1-month7 start_month end_month next1-next4; datalines; 1 2 3 4 5 6 7 2 4 2 3 4 . 1 2 3 4 5 6 7 4 7 4 5 6 7 ; run; proc print data=want; run;
... View more
I'm just checking my understanding. From what I understand, if the following is correct:
Then is the following not correct? My responses would have been: 189.87%, 696.20% and 31.54%.
... View more