09-28-2020
dr2014
Quartz | Level 8
Member since
07-22-2014
- 162 Posts
- 22 Likes Given
- 2 Solutions
- 1 Likes Received
-
Latest posts by dr2014
Subject Views Posted 1474 09-28-2020 01:33 PM 1517 09-28-2020 11:19 AM 1360 06-04-2020 09:44 AM 5665 04-27-2020 01:33 PM 5709 04-27-2020 12:47 PM 2126 11-21-2018 10:44 AM 2158 11-21-2018 09:46 AM 2167 11-21-2018 09:36 AM 2183 11-21-2018 09:09 AM 909 11-21-2018 09:02 AM -
Activity Feed for dr2014
- Posted Re: How do I plot line graphs for multiple groups with gplot? on Statistical Procedures. 09-28-2020 01:33 PM
- Posted How do I plot line graphs for multiple groups with gplot? on Statistical Procedures. 09-28-2020 11:19 AM
- Posted Adding title to gplot on Statistical Procedures. 06-04-2020 09:44 AM
- Posted Re: Remove exponents from the values on SAS Programming. 04-27-2020 01:33 PM
- Posted Remove exponents from the values on SAS Programming. 04-27-2020 12:47 PM
- Posted Re: Running frequency on Statistical Procedures. 11-21-2018 10:44 AM
- Posted Re: Running frequency on Statistical Procedures. 11-21-2018 09:46 AM
- Posted Re: Running frequency on Statistical Procedures. 11-21-2018 09:36 AM
- Posted Running frequency on Statistical Procedures. 11-21-2018 09:09 AM
- Posted Re: creating unique window periods on SAS Programming. 11-21-2018 09:02 AM
- Posted Re: creating unique window periods on SAS Programming. 11-16-2018 12:48 PM
- Posted creating unique window periods on SAS Programming. 11-16-2018 12:26 PM
- Got a Like for Re: convert year date value from character to numeric. 11-12-2018 12:08 PM
- Posted Re: convert year date value from character to numeric on SAS Programming. 11-12-2018 12:04 PM
- Posted Re: convert year date value from character to numeric on SAS Programming. 11-12-2018 12:04 PM
- Posted convert year date value from character to numeric on SAS Programming. 11-12-2018 11:53 AM
- Posted Re: proc sql using where or case and when clause on SAS Data Management. 06-04-2018 10:38 PM
- Posted proc sql using where or case and when clause on SAS Data Management. 05-23-2018 12:47 PM
- Posted Re: Accessing big data using SAS PC on SAS Data Management. 04-30-2018 11:22 AM
- Liked Re: Accessing big data using SAS PC for Kurt_Bremser. 04-30-2018 11:20 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 11-12-2018 12:04 PM
09-28-2020
01:33 PM
Thank you for the recommendation.
... View more
09-28-2020
11:19 AM
Hi all,
I need advice on how to "plot lines for multiple groups within a sas variable". I used proc lifetest to get output dataset and used proc gplot to produce an rtf file.
proc lifetest data= abc method=KM outsurv=xyz plot=(s); time duration*censor (1,2); strata group ; run;
The variable "group" has "6 categories" and proc gplot gives me plot points by default so I used symbol statement with i=spline option, but it gave me a line graph for only one group
Here is the code:
proc gplot data = xyz; symbol1 i=spline; plot survival*duration= group / vaxis=axis1 haxis=axis2 legend=legend1;; run;
How can I get line graphs for all the categories within the group? Thanks.
... View more
06-04-2020
09:44 AM
Hi all,
I ran a proc lifetest and then used gplot to get the graph. I was able to add the axes labels and legend, however the code below does not give a title. Could you please let me know what's wrong with the code? Thanks.
ods rtf file='path.rtf';
title 'abcd'; title2 '(xyz)'; goption reset=all;*ftext=simplex; symbol1 line=1 color=blue i=stepj; symbol2 line=2 color=red i=stepj; axis1 label=(angle=90 'Survival Probability'); axis2 label=('axis label name ');
legend1 label = none value = (height = 1.5) position = (top right inside) down = 2;
proc gplot data = test; plot survival*duration = grade / vaxis=axis1 haxis=axis2 legend=legend1;; run; quit;
ods rtf close;
... View more
04-27-2020
01:33 PM
Thanks for your reply @ballardw. I got the generated data step and will fix the length of the variables.
... View more
04-27-2020
12:47 PM
Hi all,
I imported a text tab delimited file into SAS 9.4 and the all the numeric fields are converted into an exponent of 10. So for e.g how do I convert 5.8432957E13 into the actual number 58432957310473 in the sas file now? The value with the exponent E is a numeric field with a best12. format and informat.
Thanks in advance for your solutions.
... View more
11-21-2018
10:44 AM
Hi @KurtBremser I am back on this string. I do need help with the complete solution. Right now, this code works for me that is edited from your first code.
proc sql;
create table want as
select characteristic, count(distinct id) as n
from have
group by characteristic;
quit;
However, I need the denominator to be the 'total number of distinct ids' to get the percent. How can I accomplish that as a nested select program in sql?
so basically I need :
proc sql;
create table want2 as
select count (distinct id) as n2
from have /* original dataset*/
quit;
so this count of distinct ids are not grouped by characteristic and my percent needs to be
n/n2*100
Hope this makes sense.
I have my code as this but I know there is something missing in it
proc sql;
create table want as
select a.characteristic, a.n, b.n2
from (select characteristic, count(distinct id) as n from have group by ccs2)
(select count(distinct id) as n2 from have) b;
quit;
So I want the three columns in the final dataset characteristic, n, n2, percent
and just to expand the data:
id
characteristic
id1
RDD
id1
TSS
id2
TSS
id2
RDD
id2
GGG
id2
HHH
So the output dataset will be
Characteristic
N
N2
%
RDD
2
2
100
TSS
2
2
100
GGG
1
2
50
HHH
1
2
50
Hope this makes it all clear. Look forward to your reply.
... View more
11-21-2018
09:46 AM
Hi @RW9 Its obvious by solution of proc freq was not helpful:
It gave an error the characteristic variable is not sorted properly.
And, the denominator for the percent has to be the total number of distinct ids.
... View more
11-21-2018
09:36 AM
Hi @Kurt_Bremser I was looking to summarize the count but since there was a condition that could be repeated for more than an id I was concerned. Also in your code how can I ensure the counts of the condition(N) is among all ids. I mean I don't see id mentioned in the code. or that is not needed.
proc sql; create table want as select characteristic, count(*) as N from have group by characteristic; quit;
... View more
11-21-2018
09:09 AM
Hi all,
I have this dataset. I need help urgently on this.
id
characteristic
id1
RDD
id1
TSS
id2
RDD
id2
TSS
I need the final result table as:
Characteristic
N
%
RDD
2
100
TSS
2
100
how can I accomplish this
I tried by sorting the data-set by characteristic and it doesn't work.
proc freq data=have by characteristic; tables id/out=want run;
Thanks.
... View more
11-21-2018
09:02 AM
Thanks for your reply @novinosrinand apologies for the delay. I had to stop working on this concern as data was insufficient and had to look into more urgent tasks. Nonetheless I will test it on available data and reply.
... View more
11-16-2018
12:26 PM
Hi ,
below is a table 'have'. I created the 'duration' column in it that looks at the duration between the 'enddate' of the previous observation and 'startdate' of the next record using the 'lag' function. I flagged any duration <32 as Y. For consecutive observation where the duration < 32 , thos have to be grouped together to create a unique period i.e. the dates of obs 1 and 2 have to be combined to get the new_startdate and new_enddate i.e 02/30/2017 to 8/1/2017.
It is possible that more than three obs with duration <32 could be combined to get the new_startdate and new_enddate.
Similarly for observation 3 and 4 I had the new_startdate and new_enddate i.e 10/30/2017 to 4/15/2018. I have thousands of such ids for each of which I need to do the steps to get the dataset 'want'
How can I accomplish the dataset 'want'? Please let me know. I need advice urgently.
have:
obs
ptid
index date
start
end
duration
flag
1
1
2/18/2018
02/30/17
5/30/2017
2
1
2/18/2018
6/1/2017
8/1/2017
2.00
y
3
1
2/18/2018
10/30/2017
11/30/2017
90.00
n
4
1
2/18/2018
12/1/2017
4/15/2018
1.00
y
I need to have this dataset 'want' below with the new_start and new_end columns:
obs
ptid
index date
start
end
duration
flag
New_start
New_end
1
1
2/18/2018
02/30/17
5/30/2017
02/30/2017
8/1/2017
2
1
2/18/2018
6/1/2017
8/1/2017
2.00
y
02/30/17
8/1/2017
3
1
2/18/2018
10/30/2017
11/30/2017
90.00
n
10/30/2017
4/15/2018
4
1
2/18/2018
12/1/2017
4/15/2018
1.00
y
10/30/2017
4/15/2018
... View more
11-12-2018
12:04 PM
And will remember that.
... View more
11-12-2018
12:04 PM
1 Like
Thank you!
... View more
11-12-2018
11:53 AM
Hi,
I have the date1 value = 1978 i.e. all in 4 digits with informat and format of $64. I want to covert it to a numeric value with a format of year4.
First I tried:
data want;
set have;
if date2=input(date1,$64);
format date2 year4.;
run;
It doesn't work.
If I remove the format statement it keeps the value as character as the original variable.
I also tried date2=input(date1, year4.); and that doesn't work too.
Thanks.
... View more