2 weeks ago
PamG
Quartz | Level 8
Member since
04-21-2023
- 61 Posts
- 20 Likes Given
- 1 Solutions
- 4 Likes Received
-
Latest posts by PamG
Subject Views Posted 343 2 weeks ago 515 2 weeks ago 595 2 weeks ago 625 2 weeks ago 303 12-07-2024 12:28 PM 326 12-07-2024 11:17 AM 347 12-07-2024 10:49 AM 545 07-31-2024 09:31 AM 620 07-30-2024 07:32 PM 680 07-30-2024 04:44 PM -
Activity Feed for PamG
- Liked Re: Days in Year Question for Astounding. 2 weeks ago
- Posted Re: find roots of a quadratic equation for each obs on SAS Programming. 2 weeks ago
- Posted Re: find roots of a quadratic equation for each obs on SAS Programming. 2 weeks ago
- Posted Re: find roots of a quadratic equation for each obs on SAS Programming. 2 weeks ago
- Posted find roots of a quadratic equation for each obs on SAS Programming. 2 weeks ago
- Posted Re: PRXMATCH with string containing ampersand on SAS Programming. 12-07-2024 12:28 PM
- Posted Re: PRXMATCH with string containing ampersand on SAS Programming. 12-07-2024 11:17 AM
- Posted PRXMATCH with string containing ampersand on SAS Programming. 12-07-2024 10:49 AM
- Posted Re: PROC MIXED with PARMS statement on SAS Procedures. 07-31-2024 09:31 AM
- Posted Re: PROC MIXED with PARMS statement on SAS Procedures. 07-30-2024 07:32 PM
- Posted PROC MIXED with PARMS statement on SAS Procedures. 07-30-2024 04:44 PM
- Liked Re: calculate weeks between a date and numeric variable for PaigeMiller. 07-29-2024 07:07 PM
- Liked Re: Date calculation at 3 months interval or trimester dates for Ksharp. 07-29-2024 06:59 PM
- Liked Re: DATALINES: SAS truncating last character for ballardw. 04-25-2024 09:18 PM
- Got a Like for Re: DATALINES: SAS truncating last character. 04-25-2024 04:30 PM
- Posted Re: DATALINES: SAS truncating last character on SAS Programming. 04-25-2024 04:26 PM
- Liked Re: DATALINES: SAS truncating last character for Reeza. 04-25-2024 04:26 PM
- Posted Re: DATALINES: SAS truncating last character on SAS Programming. 04-25-2024 03:55 PM
- Posted DATALINES: SAS truncating last character on SAS Programming. 04-25-2024 03:38 PM
- Liked Re: Renaming a dataset during a proc datasets for Ksharp. 04-22-2024 09:50 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 3 1 -
My Liked Posts
Subject Likes Posted 2 04-25-2024 04:26 PM 2 11-20-2023 10:31 AM
2 weeks ago
Thanks for the link. I looked up and got some code. However I am getting only one root.
**Example 3: Solve for a: P=2*e1 + a + a*a;
data test;
input p e1;
datalines;
12 1
24 2
36 3
;
run;
/* FCMP routine to find function roots */
proc fcmp outlib=work.fcmp.test;
function fn(e1, a);
return (2*e1 + a + a*a );
endsub;
function findZero(p, e1,init);
array solvopts[1] initial (0);
initial = init;
return (solve("fn", solvopts, p, e1, .));
endsub;
run;
options cmplib=work.fcmp.test;
data roots;
set test;
format root 5.2;
root = findZero(p, e1, 0.1);
run;
... View more
2 weeks ago
Thanks for your response. I was looking for an easier way to find the roots without having to write the equations in data step. For another project I will be having cubic polynomials. In that case how do I save the 3 roots in 3 variables? I saw some examples online who are using PROC MODEL or PROC IML. But they use some sort of starting numbers to find the roots.
... View more
2 weeks ago
I have a data set with y and x. Is there a way to find the 2 roots of a quadratic equation for each obs?
The equation is y - 2*x*R + 3*x*R**2 =0.
Sample data is
data have;
input y x;
datalines;
1 2
2 4
5 6
8 9
;
run;
... View more
12-07-2024
11:17 AM
Correction: Please note that I missed putting the ending quotation marks after /i. I cannot edit my post to make the correction.
... View more
12-07-2024
10:49 AM
How do I go about using PRXMATCH to search for a string that contains ampersand ? SAS is assuming that it is a macro variable.
data have;
input varchar $;
datalines;
ABCDEF
GHI
KLM
KLM&F
KLM&FG
;
run;
data want;set have;
if prxmatch("m/KLM&F/i,varchar) >0; *gives an error Macro variable F not resolved;
run;
... View more
07-31-2024
09:31 AM
My covariance matrix is an 8x8 matrix (Intercept+ tmean+6 days of week excluding the reference level) for each region. I need to provide covariance matrix for each region in PROC MIXED. I am not sure what the other rows/columns will be.
I am tagging @Rick_SAS .Thanks.
... View more
07-30-2024
07:32 PM
The error message is given below.
46
47
48 PROC MIXED DATA=coeff COVTEST METHOD=ML;
49 CLASS regnames;
50 MODEL estimate=/SOLUTION DDFM=BW; *P; * empty model for effect size;
51 RANDOM regnames/SOLUTION; * allowing heterogeneity in d;
52 REPEATED/GROUP=regnames TYPE=VC; * separate residual variance per study;
53 PARMS / PARMSDATA=vcov hold=1 to 8; * hold residual variances at known values;;
54 RUN;
ERROR: The PDATA= data set must contain the numeric variables Estimate or CovP1-CovP11.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: The PROCEDURE MIXED printed page 1.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
... View more
07-30-2024
04:44 PM
I have to build seperate models for each of the 9 regions and then pool the parameter coefficients . I am using PROC MIXED to meta analyze the independent results. I am following the following Gaspirini paper and trying to build it in SAS. The SAS data is also available on the following site.
https://github.com/gasparrini/2012_gasparrini_StatMed_Rcodedata/blob/master/regEngWales.csv
I keep getting an error at the PARM statement. I think I am not able to pass the covariance matrix which is fixed.
PROC IMPORT DATAFILE="myfolder\regEngWales.csv"
OUT=meta DBMS=csv REPLACE;
RUN;
%MACRO coeff(reg,regionn);
PROC GLIMMIX DATA=meta;* ASYCOV; * displays asymptotic covariance;
CLASS dow(REF="Fri");*/REF=REFERENCE;
MODEL death=tmean dow / DIST=POISSON COVB DDFM = RESIDUAL SOLUTION; **displays approximate covariance;
RANDOM _RESIDUAL_;
WHERE region=®.;;
ODS OUTPUT ParameterEstimates=coeffs®. /*covp*/ covparms=vcov®.;
run;
DATA coeffs®.;SET coeffs®.; regnames="®ionn."; n=_N_;RUN;
DATA vcov®.;SET vcov®.; regnames="®ionn."; n=_N_; RUN;
%MEND;
%coeff(1,%STR(N-East)); %coeff(2,%STR(N-West)); %coeff(3,%STR(York&Hum)); %coeff(4,%STR(E-Mid));
%coeff(5,%STR(W-Mid)); %coeff(6,%STR(East)); %coeff(7,%STR(London)); %coeff(8,%STR(S-East));
%coeff(9,%STR(S-West)); %coeff(10,%STR(Wales));
***process coeff data;
DATA coeff; FORMAT regnames $10.; SET coeffs1-coeffs10;
IF effect IN ("Residual") OR dow IN ("Fri") THEN DELETE;
KEEP effect dow estimate regnames n;
RUN;
***process covariance data;
DATA vcov; FORMAT regnames $10.; SET vcov1-vcov10;
IF dow IN ("Fri") THEN DELETE;
*KEEP effect dow estimate regnames n;
RENAME col1=covp1 col2=covp2 col3=covp3 col4=covp4 col5=covp5 col6=covp6 col7=covp7 col8=covp8;
DROP effect dow col9 n regnames;
RUN;
PROC MIXED DATA=coeff COVTEST METHOD=ML;
CLASS regnames;
MODEL estimate=/SOLUTION DDFM=BW; *P; * empty model for effect size;
RANDOM regnames/SOLUTION; * allowing heterogeneity in d;
REPEATED/GROUP=regnames TYPE=VC; * separate residual variance per study;
PARMS / PARMSDATA=vcov hold=1 to 8; * hold residual variances at known values;;
RUN;
... View more
04-25-2024
04:26 PM
2 Likes
Thank you so much Reeza! I never thought of using LENGTH.
... View more
04-25-2024
03:38 PM
This seems like a very simple thing but I just can't seem to get it write. When using the code below, SAS is truncating the last character wherever variable length is greater than 9.
DATA bins;
INPUT binnum bin_desc $ @@;
FORMAT bin_desc $10.;
DATALINES;
1 [-20,-15) 2 [-5,0) 3 [0,5) 4 [5,10) 5 [10,15) 6 [15,20) 7 [20,25) 8 [25,30) 8 [30,35) 10 [35,40)
11 [40,45) 12 [45,50) 13 [55,60) 14 [60,65) 15 [65,70) 16 [70,75) 17 [75,80) 18 [80,85) 19 [85,90)
20 [90,95) 21 [95,100) 22 [100,HI)
;
RUN;
... View more
04-18-2024
09:23 AM
@Ksharp Thank you so much. This is exactly what I was looking for!!!
... View more
04-17-2024
06:17 PM
Timelist and ATRISK option gives identical results. I am running this on my real data and the numbers are off. Also on my real data, timelist gives a value of zero at the last time of followup while the ATRISK gives a number.
... View more