08-12-2022
saslove
Quartz | Level 8
Member since
10-04-2011
- 78 Posts
- 2 Likes Given
- 3 Solutions
- 3 Likes Received
-
Latest posts by saslove
Subject Views Posted 637 08-12-2022 10:34 AM 1435 02-05-2020 07:12 PM 858 10-22-2019 04:02 PM 895 10-21-2019 07:19 PM 8769 10-18-2019 02:31 PM 8817 10-18-2019 12:25 PM 1496 08-02-2019 12:53 PM 1499 08-02-2019 12:51 PM 1557 08-01-2019 09:03 PM 1583 08-01-2019 06:48 PM -
Activity Feed for saslove
- Posted Flyover of a number on ODS and Base Reporting. 08-12-2022 10:34 AM
- Got a Like for Re: INSERT NEW LINE IN RTF. 03-04-2020 01:49 AM
- Posted PROC SQL max value with corresponding visit on SAS Programming. 02-05-2020 07:12 PM
- Posted Re: SAS Custom Sort on SAS Programming. 10-22-2019 04:02 PM
- Posted Re: SAS Custom Sort on SAS Programming. 10-21-2019 07:19 PM
- Liked Re: SAS Custom Sort for FreelanceReinh. 10-21-2019 06:28 PM
- Posted Re: SAS Custom Sort on SAS Programming. 10-18-2019 02:31 PM
- Posted SAS Custom Sort on SAS Programming. 10-18-2019 12:25 PM
- Posted Re: Strip date stamp from 30 datasets on SAS Programming. 08-02-2019 12:53 PM
- Posted Re: Strip date stamp from 30 datasets on SAS Programming. 08-02-2019 12:51 PM
- Posted Re: Strip date stamp from 30 datasets on SAS Programming. 08-01-2019 09:03 PM
- Posted Strip date stamp from 30 datasets on SAS Programming. 08-01-2019 06:48 PM
- Posted Re: Go through all datasets in a directory and delete columns that contain a specific text on SAS Programming. 05-13-2019 02:03 PM
- Posted Re: Go through all datasets in a directory and delete columns that contain a specific text on SAS Programming. 05-10-2019 07:08 PM
- Posted Re: Go through all datasets in a directory and delete columns that contain a specific text on SAS Programming. 05-10-2019 06:31 PM
- Posted Re: Go through all datasets in a directory and delete columns that contain a specific text on SAS Programming. 05-10-2019 06:15 PM
- Posted Re: Go through all datasets in a directory and delete columns that contain a specific text on SAS Programming. 05-10-2019 06:03 PM
- Posted Re: Go through all datasets in a directory and delete columns that contain a specific text on SAS Programming. 05-10-2019 05:55 PM
- Posted Re: Go through all datasets in a directory and delete columns that contain a specific text on SAS Programming. 05-10-2019 04:58 PM
- Posted Re: Go through all datasets in a directory and delete columns that contain a specific text on SAS Programming. 05-10-2019 03:39 PM
-
Posts I Liked
Subject Likes Author Latest Post 4 1 -
My Liked Posts
Subject Likes Posted 1 01-21-2019 05:51 PM 1 11-23-2018 12:05 PM 1 11-22-2018 03:46 PM
08-12-2022
10:34 AM
I understand flyover can do text strings but is there a way to insert a number to the Proc report? For example, what I am reporting is the adverse events by highest grade. Step 1 - What I need is a flyover option to have the N beside the highest grade. Next steps - I would also love to have N with lower grades than the highest grade, but that's for another day after I figure out step 1. Is this feasible?
... View more
02-05-2020
07:12 PM
Hello all, I have calculated the max value of three variables separately. However, I need the time point associated with the max of these three. How do I calculate that? For ex: if a subject has 8 values at different time points, I need the max value and it's associate time points for 3 different variables.
proc sql;
create table peak as
select subject, max(cd1922) as peakcd1922, max(cd19) as peakcd19, max(cd22) as peakcd22,
sum(calculated peakcd1922,calculated peakcd19,calculated peakcd22) as peakCarT
from engraft
group by subject;
quit;
... View more
10-22-2019
04:02 PM
Thanks! That makes sense, thanks for all the explanation. It really helps me understand this code. For production, I have used @novinosrin's method. I did want to try out what @FreelanceReinh suggested, so I was trying on a test window.
... View more
10-21-2019
07:19 PM
Does the length of the variable have anything to do with this statement? My variable length for "c" is $9. And it doesn't work as expected. What am I missing?
proc sql;
create table test as
select c from mydata
order by mod(input(c,bits24.)+1,10);
quit; /* assuming ASCII encoding */
... View more
10-18-2019
12:25 PM
I have the following treatments
A1A
A1Y
A1Z
B1A
B1Y
B1Z
But I need to display on the report in the following order based on dose level.
A1Y
A1Z
A1A
B1Y
B1Z
B1A
If I try to use PROC FORMAT, it only displays the numbers which I don't want. Please help how I can custom sort to get the alphabetical dose levels and not mere numbers.
proc format; value $cohort 'A1Y'=1 'A1Z'=2 'A1A'=3 'B1Y'=4 'B1Z'=5 'B1A'=6 'ND'=7 'P'=8; run;
... View more
08-02-2019
12:53 PM
Thanks for the tip. However, the data dump occurs automatically from a very old database. So, there is no way to remove the date stamp. We had already looked into this to save time. I posted here since that was not a possibility. I used the wildcard tip from @Reeza and it works great.
... View more
08-02-2019
12:51 PM
Thanks for the wildcard idea, Reeza. I used it in my import step for all my 33 datasets and it runs perfectly.
Sharing the code for future reference
%let datafiledt=2019_0729;
%macro import (myfilename=,workfile=);
proc import out=work.&workfile datafile="\\server\study\data download\&datafiledt.\&myFilename._*.csv" DBMS=CSV REPLACE; guessingrows=65465; run;
%mend import;
%import (myfilename=study-datafile1,workfile=datafile1); %import (myfilename=study-datafile2,workfile=datafile2);
and so on..
... View more
08-01-2019
09:03 PM
That’s correct. I don’t need to keep the past data. But even I am going to, it’s alright.
... View more
08-01-2019
06:48 PM
I have a library that contains ~30 datasets. Every week, new data is downloaded and the data gets saved with a date stamp.
I re-run my reports every week on newly updated data. The issues I run into is each time I have to copy the name of the date stamp since the variable name changes because the date stamp changes.
Is there a way to code this in SAS that can get rid of the date stamp and save the datasets without these datestamps so that the dataset name doesn't need to be changed in my report each week? Currently, I right-click, rename, remove the '_DATA_2019-07-29_1343', which is not the smartest way.
For ex: I have protocol01-Dataset1_DATA_2019-07-29_1342
protocol01-Dataset2_DATA_2019-07-29_1343
and so on..
Thanks for your help!
... View more
05-13-2019
02:03 PM
@Patrick Thank you. I was able to use this logic and apply my code to all datasets. It works great. Thanks very much for the assistance.
Posting the code here for reference:
/*Dropping all date variables*/ /* define parameters */ %let libref=temp; %let col_pattern=DTC;
/* use call execute to drop a list of columns dynamically populated into SAS variable DropList */ data _null_; set sashelp.vcolumn(keep=libname memname name where=(libname=%upcase("&libref") and find(name,"&col_pattern",'i')>0)); by libname memname; length DropList $32767; retain DropList; DropList=catx(',',DropList,name); if last.memname then do; call execute(catx(' ', 'proc sql; alter table', cats(libname,'.',memname),'drop', DropList, ';quit;')); call missing(DropList); end; run;
... View more
05-10-2019
07:08 PM
Thanks for the tip. Could you guide me through how I would apply this step to all datasets in my directory. If I don't use call execute, what would I do here instead?
%macro drop (dn); %let dropme=; proc sql noprint; SELECT name INTO :dropMe SEPARATED BY ' ' FROM sashelp.vcolumn WHERE libname = 'TEMP' AND memname = upcase("&dn") AND INDEX(upcase(NAME),'DTC')>0; quit;
%put &sqlobs; %put &dropme;
%if &sqlobs > 0 %then %do; data test; set temp.&dn; drop &dropme; run; %end;
%mend drop;
%drop (bma);
proc contents data=temp._all_ noprint out=contents; run;
data _null_; set contents; by memname ; where index(upcase(name),'DTC') > 0; call execute(cats('%drop(',memname,')')); run;
... View more
05-10-2019
06:31 PM
The macro works fine if I try it on individual datasets.
It gives me exactly what I need when I do a manual run on datasets
%drop (bma); >> works great
%drop (tox); >> works great
It's only when I try the data _null_ and apply at once to all datasets, it breaks. It says no drop variables found.
... View more
05-10-2019
06:15 PM
@Astounding It's still holding to the earlier datasets DTC variables. The DTC variable name changes with each dataset.
%macro drop (dn); proc sql noprint; SELECT name INTO :dropMe SEPARATED BY ' ' FROM sashelp.vcolumn WHERE libname = 'TEMP' AND memname = upcase("&dn") AND INDEX(upcase(NAME),'DTC')>0; quit;
%if &sqlobs > 0 %then %do; data test; set temp.&dn; drop &dropme; run; %end;
%mend drop;
proc contents data=temp._all_ noprint out=contents; run;
data _null_; set contents; by memname ; if first.memname; where index(upcase(name),'DTC') > 0; call execute(cats('%drop(',memname,')')); run;
... View more
05-10-2019
06:03 PM
That was only an example of what I am trying to achieve and not the actual macro.
I tried this way, but it still holds on to the pre-resolved macro.
%macro drop (&dn); proc sql noprint; SELECT name INTO :dropMe SEPARATED BY ' ' FROM sashelp.vcolumn WHERE libname = 'TEMP' AND memname = upcase("&dn") AND INDEX(upcase(NAME,'DTC'))>0; quit;
%if &sqlobs > 0 %then %do; data test; set temp.&dn; drop &dropme; run; %end;
%mend drop;
proc contents data=temp._all_ noprint out=contents; run;
data _null_; set contents; by memname ; if first.memname; call execute(cats('%drop(',memname,')')); run;
... View more