05-06-2023
japelin
Rhodochrosite | Level 12
Member since
08-15-2018
- 622 Posts
- 59 Likes Given
- 133 Solutions
- 290 Likes Received
-
Latest posts by japelin
Subject Views Posted 2719 10-31-2022 08:40 AM 696 10-26-2022 01:12 AM 858 10-17-2022 01:47 AM 967 09-29-2022 04:43 AM 804 09-29-2022 04:15 AM 1183 09-27-2022 01:05 AM 869 09-19-2022 11:19 PM 901 09-19-2022 11:00 PM 573 09-19-2022 09:41 PM 1676 09-19-2022 09:28 PM -
Activity Feed for japelin
- Got a Like for Re: Como usar API no SAS Enterprise Guide?. 12-04-2023 04:20 PM
- Liked Re: temp sas dataset for SASKiwi. 12-04-2022 11:06 AM
- Posted Re: Reduce run time on SAS Programming. 10-31-2022 08:40 AM
- Posted Re: Wrong command on SAS Programming. 10-26-2022 01:12 AM
- Posted Re: How to find length on SAS Programming. 10-17-2022 01:47 AM
- Got a Like for Re: Creating SAS macro (YYYYMM) based on SAS macro (TIMESTAMP). 09-29-2022 07:10 AM
- Posted Re: Char to numeric on SAS Programming. 09-29-2022 04:43 AM
- Posted Re: Creating SAS macro (YYYYMM) based on SAS macro (TIMESTAMP) on SAS Programming. 09-29-2022 04:15 AM
- Posted Re: Sort by datetime on SAS Programming. 09-27-2022 01:05 AM
- Got a Like for Re: Protecting data sets using read/write/alter syntax or is there a better option?. 09-21-2022 12:50 PM
- Posted Re: Grouping data on SAS Programming. 09-19-2022 11:19 PM
- Posted Re: Grouping data on SAS Programming. 09-19-2022 11:00 PM
- Posted Re: How to code this column (point)? on SAS Programming. 09-19-2022 09:41 PM
- Posted Re: Protecting data sets using read/write/alter syntax or is there a better option? on SAS Programming. 09-19-2022 09:28 PM
- Posted Re: data flow on SAS Programming. 09-15-2022 11:50 PM
- Posted Re: data flow on SAS Programming. 09-15-2022 11:08 PM
- Posted Re: programming help on SAS Programming. 09-15-2022 04:58 AM
- Posted Re: programming help on SAS Programming. 09-15-2022 04:25 AM
- Posted Re: Data _null_ on SAS Programming. 09-15-2022 04:12 AM
- Posted Re: combine date +time into one field on SAS Programming. 09-15-2022 03:57 AM
-
Posts I Liked
Subject Likes Author Latest Post 2 1 6 2 3 -
My Liked Posts
Subject Likes Posted 1 09-29-2022 04:15 AM 1 09-19-2022 09:28 PM 1 08-29-2022 11:55 AM 1 08-31-2022 02:45 AM 1 08-25-2022 03:48 AM
09-15-2022
03:57 AM
Can the code for the entire step, not just the dhms function part, be timed as much as possible?
... View more
09-15-2022
03:46 AM
What exactly is the value of "bad results"?
I think your code will give you the datetime value without any problem.
data have;
date='08sep2022'd;time='12:57't;output;
date='14sep2022'd;time='8:15't;output;
format date date9. time time5. ;
run;
data want;
set have;
date_time =dhms(date, 0, 0, time );
format date_time datetime16.;
run;
proc print;run;
proc sql;
select have.*, dhms(date, 0, 0, time )as date_time format=datetime16. from have;
quit;
... View more
09-02-2022
04:20 AM
In the meantime, is it possible to upload the code before and after? Normally, %eval is not necessary if such a value is stored in a macro variable.
You could run the following code and check the logs to see how SAS is processing the macro.
options mprint mlogic symbolgen;
... View more
08-31-2022
02:45 AM
1 Like
how about this code.
%do MM = 01 %to 12;
%if &MM<10 %then %let MM=0&MM.; /* Add this line */
... View more
08-29-2022
11:55 AM
1 Like
I see your point. When I tried to Git manage my SAS program and SAS logs, I too was very uncomfortable with the fact that the slight discrepancies that occur in the logs each time they are executed are detected as differences. I used various options to make the execution log itself tolerable for detecting differences, but I couldn't do anything about the page breaks, and I didn't want to add a PS option for that, so I decided to write my own program to exclude unwanted lines from the log. I digress. I usually use an older type of SAS (DMS environment) and don't use SAS Studio, so I don't know the details, but perhaps the batch execution uses the internal processing of the older SAS. (I can guess from the fact that the print is in lst format) If enough people speak out to Technical Support, this may be fixed in the future, but as it stands now, it is difficult. I think a compromise needs to be made somewhere.
... View more
08-29-2022
06:40 AM
SAS Studio does not have pagesize option.
Instead of setting preference you can try this code for changing PageSize.
options ps=32767;
> This will reduce them significantly. Not sure if there's a way to remove it entirely.
... View more
08-26-2022
04:12 AM
If you are using the PC version of SAS 9.4 and have set up automatic saving as described below, then the program you are editing may remain in the folder %AppData%\SAS\EnhancedEditor. Please note, however, that the program remains in case SAS is terminated unintentionally, and not if SAS is terminated normally.
... View more
08-25-2022
03:48 AM
1 Like
submit %global before submit macro or first in macro.
%global fromdate;
%Start_Date;
%MACRO Start_Date;
%global fromdate;
%if %sysfunc(exist(ttt)) %then %do;
...
... View more
08-22-2022
07:17 AM
I think the garbled characters are a functional defect of Universal Viewer. When opening the xpt(v5) file at hand, the characters are garbled even if the character encoding is utf-8 or SJIS.
Unlike SAS datasets, xpt files do not have encoding information embedded in them. Therefore, when opening an xpt file, the only way to know the encoding other than asci is to guess it from the byte array, but I don't think Universal Viewer has such a feature.
... View more
08-20-2022
11:03 AM
Thank you all very much. I have solved the problem and here is the sample code.
The part where the layout is adjusted and output is PROC REPORT, and the subsequent fine tuning was handled by rewriting the RTF control code.
ods _all_ close;
ods noresults;
filename rtf_in "%sysfunc(pathname(work))\rtf_in.rtf";
filename rtf_out "%sysfunc(pathname(work))\rtf_out.rtf";
ods rtf file=rtf_in;
title;
options nodate nonumber nobyline;
proc sort data=sashelp.class out=class;
by name;
run;
proc report data=class nowd;
column name NameLabel sex age height weight;
by name;
define NameLabel / ''
computed
style(header)=[just=l
backgroundcolor=white
BorderTopColor=White
BorderLeftColor=White
BorderRightColor=White
BorderBottomColor=White];
define name / noprint;
compute NameLabel / character length=40;
call define(_col_,'style','style={just=l
fontweight=bold
fontsize=14pt
cellwidth=15cm
BorderTopColor=White
BorderLeftColor=White
BorderRightColor=White
BorderBottomColor=White}');
NameLabel ='Name: '||name;
endcomp;
compute sex;
call define(_col_,'style','style={just=l cellwidth=7.5cm}');
endcomp;
compute age;
call define(_col_,'style','style={just=l cellwidth=7.5cm}');
endcomp;
compute height;
call define(_col_,'style','style={just=l cellwidth=7.5cm}');
endcomp;
compute weight;
call define(_col_,'style','style={just=l cellwidth=7.5cm}');
endcomp;
run;
ods rtf close;
data _null_;
infile rtf_in;
file rtf_out;
input;
if _infile_='\pard\par' then _infile_='\pard';
else if index(_infile_,'\sect') then delete;
put _infile_;
run;
Results:
... View more
08-19-2022
12:45 PM
If you want to get the filter from the data, you could put it in a macro variable or something, but if you want to simply code it would be faster to use the in operator rather than a bunch of if's and ='s and OR's.
where codeID in ('a111' 'a112' 'a113');
... View more
08-19-2022
11:42 AM
1 Like
how about this code?
proc sql;
create table want as
select PT_class, Charge, round(charge/sum(Charge)*100,0.01) as perc
from dataIN
;
quit;
... View more
08-18-2022
07:56 PM
If Date is character variable, use anydtdtm informat for converting to date value.
data _null_;
Date='30AUG2022:11:15:00.000';
dt=input(Date,anydtdtm22.);
da=datepart(dt);
tm=timepart(dt);
format da date9.
tm time12.4;
run;
... View more
08-18-2022
07:50 PM
Is Date variable numeric?
Then use these.
data _null_;
Date='30AUG2022:11:15:00.000'dt;
da=datepart(Date);
tm=timepart(Date);
format da date9.
tm time12.4;
run;
... View more
08-17-2022
04:12 AM
Macro variables created by call symput cannot be accessed as macro variables until the DATA step is completed, so please do the following.
Data _null_;
Call symputx('firstm_start_date1', put(intnx('qtr', today(), -1, 'B'), date11.)) ;
run;
Data _null_;
Call symputx('thirdm_start_date1', put(intnx('month', "&firstm_start_date1."d, 2,'B'), date11.)) ;
run;
Also, the "D" indicating the date must appear immediately after the quotation marks, so remove the space
... View more