01-31-2024
jason4sas
Obsidian | Level 7
Member since
12-14-2018
- 15 Posts
- 8 Likes Given
- 0 Solutions
- 1 Likes Received
-
Latest posts by jason4sas
Subject Views Posted 1705 01-29-2024 08:33 AM 1720 01-29-2024 08:11 AM 1834 01-28-2024 05:47 PM 840 01-04-2024 02:51 PM 1482 12-01-2023 01:29 PM 1590 11-29-2023 02:39 PM 1651 11-29-2023 10:39 AM 1241 07-14-2023 08:35 AM 1330 07-12-2023 03:50 PM 1544 03-07-2019 05:02 PM -
Activity Feed for jason4sas
- Liked Re: Why asterisk comments working in MACRO? for Tom. 01-29-2024 09:18 AM
- Posted Re: Why asterisk comments working in MACRO? on SAS Programming. 01-29-2024 08:33 AM
- Posted Re: Why asterisk comments working in MACRO? on SAS Programming. 01-29-2024 08:11 AM
- Posted Why asterisk comments working in MACRO? on SAS Programming. 01-28-2024 05:47 PM
- Liked Re: Output ‘PearsonCorr’ was not created for PaigeMiller. 01-05-2024 09:02 AM
- Posted Output ‘PearsonCorr’ was not created on Statistical Procedures. 01-04-2024 02:51 PM
- Posted Re: %str inside of %sysfunc(ifc()) on SAS Programming. 12-01-2023 01:29 PM
- Liked Re: %str inside of %sysfunc(ifc()) for Tom. 12-01-2023 01:17 PM
- Liked Re: %str inside of %sysfunc(ifc()) for Patrick. 12-01-2023 01:17 PM
- Posted Re: %str inside of %sysfunc(ifc()) on SAS Programming. 11-29-2023 02:39 PM
- Posted %str inside of %sysfunc(ifc()) on SAS Programming. 11-29-2023 10:39 AM
- Liked Re: Double %Do %until %end Loop in Macro environment not working as expected for Kurt_Bremser. 08-08-2023 01:52 PM
- Liked Re: Truncated values after TRANWRD function for ballardw. 07-17-2023 09:32 AM
- Liked Re: Truncated values after TRANWRD function for Tom. 07-17-2023 09:32 AM
- Posted Re: Truncated values after TRANWRD function on SAS Programming. 07-14-2023 08:35 AM
- Posted Truncated values after TRANWRD function on SAS Programming. 07-12-2023 03:50 PM
- Posted Re: In-Memory Statistics: How to control temporary variable length on SAS Academy for Data Science. 03-07-2019 05:02 PM
- Posted Re: In-Memory Statistics: How to control temporary variable length on SAS Academy for Data Science. 03-06-2019 11:04 AM
- Posted In-Memory Statistics: How to control temporary variable length on SAS Academy for Data Science. 03-05-2019 10:59 AM
- Posted In-Memory Statistics Case Study: What is admission classification? on SAS Academy for Data Science. 03-05-2019 10:48 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 3 1 1 1 -
My Liked Posts
Subject Likes Posted 1 02-12-2019 09:30 AM
01-29-2024
08:33 AM
Thanks Tom's mprint, I might have got the reason: *%abc does not contain macro statements, so it was put in the word queue where the statement is regarded as SAS statement and * does work then to comment out %abc. However, %let is a standard macro statement so it got executed immediately. Please straighten me out if it still is not much correct.
... View more
01-29-2024
08:11 AM
Thanks for the help. I am trying to understand why * before %abc does block the execution of the macro, whereas it does not in *%let x=%abc; I am not sure if ";" plays any role after *%abc since it does not change the result at all.
... View more
01-28-2024
05:47 PM
I got this from Carpenter's book (Complete Guide to the SAS Macro language): %macro abc; *%put #1#@ In abc; %mend; %macro doit; *%abc %put #2#@ Here; *%let x=%abc; %put #2#@ &=x; %mend; %doit; I assumed * will not work inside of a macro, but got results as here: #2#@ Here #1#@ In abc #2#@ X=* This indicates that the * does comment out %abc. Why?
... View more
01-04-2024
02:51 PM
I have this simple snippet in SAS9, ods select PearsonCorr; ods output PearsonCorr=RA_RF_PearsonCorr; proc corr data=RA_COST_&ra_condition._all rank pearson;
var &response_cost.;
with &ra_rf_st_flag_vars.;
run; NOTE: The data set WORK.RA_RF_PEARSONCORR has 12 observations and 4 variables. NOTE: Compressing data set WORK.RA_RF_PEARSONCORR increased size by 100.00 percent. Compressed is 2 pages; un-compressed would require 1 pages. WARNING: Output ‘PearsonCorr’ was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate * * procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. NOTE: PROCEDURE CORR used (Total process time): real time 0.01 seconds user cpu time 0.01 seconds I could not find anything wrong with it. Also, strangely the same snippet is running fine in SAS Viya4. How to block it from happening in SAS9?
... View more
12-01-2023
01:29 PM
Thanks Tom. Combining with the reply from ballardw, I finally got what is going on: The unmasked comma in &final_class is regarded as one parameter separator by IFC in the macro facility, then only the first segment is returned since the condition evaluation is positive.
... View more
11-29-2023
02:39 PM
Agree. But still, how come the returned value is truncated? If I simply replace the macro variable with its true value, the truncation is not happening: %put WARNING: %sysfunc(ifc(%length(abv,bdev),%str(,abv,bdev),)); WARNING: ,abv,bdev Therefore, it seems %str(,&final_class) coming with something unexpected inside of the %sysfunc.
... View more
11-29-2023
10:39 AM
I got a truncation issue when trying to conditionally add a comma before the string “a,b”: %let final_class= abv,bdev; %put WARNING: %sysfunc(ifc(%length(&final_class.),%str(,&final_class.),)); WARNING: ,abv I acknowledge that it can be fixed by an extra masking &final_class with %quote or something, but don't understand why it got truncated in the current setting. Thanks
... View more
07-14-2023
08:35 AM
Two more questions on this thread: 1) I am curious why TRANWRD function does not base the resultant value length on the target string, i.e. the variable ALL in the example. Different with other string functions, TRANWRD must have one and only one target. Is it very natural for the function to return a new value with the equal length, if its length is not yet defined? With this assumption, the variable NEW was not defined originally in the DATA-step. 2) How can TRANWRD be used as operands of another function, such as COALESCEC function. I.e. in order to avoid the truncation issue, must the resultant value be given to a pre-defined variable first? Here is the program where the truncation was originally found: proc sql; select coalescec(tranwrd(o.all,'ONE','TWOO'),t.all) as newcode length=500 from onedata as o natural left join twodata as t ; quit; Clearly, truncation in TRANWRD still happens without being affected by the good length of NEWCODE. It will work that a temporary variable temp_var is derived first based on tranwrd(o.all,'ONE','TWOO'), then coalescec(calculated temp_var, t.all). However, the coding is a little clumsy. Is there another way to make it better?
... View more
07-12-2023
03:50 PM
The value got strangely truncated: data _null_; length all $8000; all='a9cb8d8d-a06d-4d77-a80b-8d69fe0808e5,48df6303-01d4-4181-84de-661a2f7267a1,HLS_ADVERSE_EVENT,severity_cd,VARCHAR(100),severity::coding[*]::code,ZERO-TO-ONE,FALSE,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,null,null,sas,sas'; new=tranwrd(all,"ZERO-TO-ONE","ZERO-TO-MANY"); put _all_; run; ---------------------------------These red characters were gone. all=a9cb8d8d-a06d-4d77-a80b-8d69fe0808e5,48df6303-01d4-4181-84de-661a2f7267a1,HLS_ADVERSE_EVENT,seve rity_cd,VARCHAR(100),severity::coding[*]::code,ZERO-TO-ONE,FALSE,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,null ,null,sas,sas new=a9cb8d8d-a06d-4d77-a80b-8d69fe0808e5,48df6303-01d4-4181-84de-661a2f7267a1,HLS_ADVERSE_EVENT,seve rity_cd,VARCHAR(100),severity::coding[*]::code,ZERO-TO-MANY,FALSE,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,nul l,nu _ERROR_=0 _N_=1 I don't know why they are got truncated. Thanks
... View more
03-07-2019
05:02 PM
Many thanks for the solution. Alternatively, can blank spaces be used to pack it up like this? tempexpress="if number NE 'big' then bigsmall='bigger '; else bigsmall='smaller';"; There is an empty space after the text in 'bigger'. it should also work, right? Jason
... View more
03-06-2019
11:04 AM
Sure. Here is the info: module: Module 2: Big Data Programming and Loading course: Getting Started with SAS® In-Memory Statistics lesson: Chapter 3 Exercise 2-b Thanks
... View more
03-05-2019
10:59 AM
I was computing a temp variable with proc imstat: crosstab re_subj*bigsmall/ tempnames=bigsmall tempexpress="if number='big' then bigsmall='bigger '; else bigsmall='smaller';"; run; The values for 'smaller' is 1-character shorter, i.e. 'smalle' instead. Therefore, I assume it is a variable length problem, like in data step. Is there any way to fix the issue in proc imstat. Thanks
... View more
03-05-2019
10:48 AM
I have trouble to locate the variable for admission classification in In-Memory Statistics Case Study. Specifically, it is in Question #3: "a. Produce crosstabs of gender with hour load and admission type divided by admission classification." I am assuming the variable for admission type is variable admit in the dataset, but which is for admission classification? Thanks for helping out.
... View more
02-12-2019
09:30 AM
1 Like
It's a great explanation. Thanks Mark. I kind of like the properties of the temporary array in DS2, due to its global scope, persistence during iteration, and being auto dropped in the end. Is there any other identifier like it in DS2? Also, is there any downside with it, such as processing speed etc.? Thanks.
... View more
02-11-2019
03:38 PM
I have a question related to variable scope. The example snippet may go this way: ------------------------------ proc ds2; data _null_; /*THIS IS A REGULAR VAR & AN ARRAY*/ dcl int somenum; dcl int numarray[3]; /*ASSIGNING VALUES*/ method init(); somenum=100; numarray := (10, 11, 12); end; /*CHECKING */ method run(); set sashelp.class; put somenum= numarray[1]= numarray[2]= numarray[3]=; end; enddata; run; quit; ---------------------- The result would show that the values in numarray are retained but not the variable somenum. Why? Thanks for helping out, Jason
... View more