Friday
Rampsas1
Obsidian | Level 7
Member since
01-23-2018
- 19 Posts
- 4 Likes Given
- 1 Solutions
- 1 Likes Received
-
Latest posts by Rampsas1
Subject Views Posted 1586 07-19-2024 08:05 PM 1613 07-19-2024 07:19 AM 1703 07-19-2024 06:59 AM 1735 04-25-2023 05:28 PM 1744 04-25-2023 04:51 PM 1919 04-22-2023 02:13 PM 11173 05-21-2020 08:35 AM 11220 05-18-2020 02:45 PM 11293 05-17-2020 06:22 PM 3609 02-03-2019 11:23 AM -
Activity Feed for Rampsas1
- Liked Re: SAS Exam A00-232 - specific question regarding comma separated list for Tom. 07-23-2024 07:09 AM
- Posted Re: SAS A00-232 Official Practice Exams on SAS Certification. 07-19-2024 08:05 PM
- Posted SAS Exam A00-232 - specific question regarding comma separated list on SAS Programming. 07-19-2024 07:19 AM
- Posted SAS A00-232 Official Practice Exams on SAS Certification. 07-19-2024 06:59 AM
- Liked Re: Macro quoting (‘masking’) - when is "unquoting done for you" for Quentin. 04-26-2023 06:36 AM
- Liked Re: Macro quoting (‘masking’) - when is "unquoting done for you" for Quentin. 04-25-2023 05:29 PM
- Posted Re: Macro quoting (‘masking’) - when is "unquoting done for you" on SAS Programming. 04-25-2023 05:28 PM
- Posted Re: Macro quoting (‘masking’) - when is "unquoting done for you" on SAS Programming. 04-25-2023 04:51 PM
- Liked Re: Macro quoting (‘masking’) - when is "unquoting done for you" for sbxkoenk. 04-25-2023 04:51 PM
- Posted Macro quoting (‘masking’) - when is "unquoting done for you" on SAS Programming. 04-22-2023 02:13 PM
- Posted Re: ODS Excel - make column width 'behave' like excel format / alignment / 'shrink to fit' on SAS Programming. 05-21-2020 08:35 AM
- Posted Re: ODS Excel - make column width 'behave' like excel format / alignment / 'shrink to fit' on SAS Programming. 05-18-2020 02:45 PM
- Posted ODS Excel - make column width 'behave' like excel format / alignment / 'shrink to fit' on SAS Programming. 05-17-2020 06:22 PM
- Got a Like for Re: Base Programming for SAS 9 Exam. 06-11-2019 08:16 PM
- Posted Re: sas base programming practice exam on SAS Certification. 02-03-2019 11:23 AM
- Posted Re: sas base programming practice exam on SAS Certification. 02-02-2019 03:09 PM
- Posted Re: Arrays on SAS Programming. 12-12-2018 03:28 PM
- Posted Arrays on SAS Programming. 12-12-2018 01:46 PM
- Posted Re: Base Programming for SAS 9 Exam on SAS Programming. 09-11-2018 02:59 PM
- Posted Re: Base Programming for SAS 9 Exam on SAS Programming. 09-10-2018 10:02 AM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 4 1 -
My Liked Posts
Subject Likes Posted 1 09-10-2018 09:58 AM
07-19-2024
08:05 PM
Many thanks for the reply. Your explanation and guidance make sense. I will mark this specific inquiry as 'answered.'
Additionally, being that you are an official SAS employee, I might also direct you to my post below regarding an 'observation' about a specific question on the A00-232 practice exam.
(I - and at least one other - believe this is likely an oversight in the question wording and/or expected answer. Not a real issue on the practice exam but would be an issue if the same question and expected answer appears on the actual exam)
https://communities.sas.com/t5/SAS-Programming/SAS-Exam-A00-232-specific-question-regarding-comma-separated/m-p/936329#M368062
... View more
07-19-2024
07:19 AM
Hello,
Below is a specific question from A00-232 practice exam located here https://learn.sas.com/course/view.php?id=9
(I might assume that there are different practice test versions for different users)
"Use SAS dictionary tables, run a PROC SQL query to create a macro variable named COL_LIST which contains a comma separated list of the columns contained in the CERT.AIR10 data set"
i) Per SAS, the correct answer is: DATE, AIR << with a comma + space delimiter
>>> select name into :col_list separated by ', '
ii) If we are indeed using a comma separated list, then the correct answer is: DATE,AIR << with a comma delimiter ONLY
>>> select name into :col_list separated by ','
I answered as in ii) but it was marked incorrect.
Not an issue on a practice exam but it might be an issue on the actual exam.
Any observations on my assessment?
many thanks
... View more
07-19-2024
06:59 AM
Hello,
I have taken the A00-232 practice exam here: https://learn.sas.com/course/view.php?id=9
I can "re-attempt QUIZ" seemingly as many times as desired.
However, it is always the exact same exam (with the exact same questions).
Can I take a different A00-232 practice exam with different questions (even for purchase), and if so, how / where?
many thanks for any guidance
... View more
04-25-2023
05:28 PM
Quentin,
Many thanks for the quite valuable feedback and insight. I do appreciate you doing a deep dive and providing additional references.
“How the Macro Processor Executes a Compiled Macro” / “Restoring the Significance of Symbols” / Susan O’Connor pdf
My recent observations also align with "the word scanner knowing how to handle delta characters and treating them as tokens when appropriate."
Furthermore, not sure if you agree with this ad-hoc assessment
"I’m not certain that the MP ever <directly> returns text to the WS. The WS reads from the IB - aka Input Buffer/ Stack - (only and ever? ..aka “tokenizes the text”) and then sends any macro triggers to the MP."
My walnut size SAS brain needs to still 'see it in context' so the attached Excel doc outlines two simple processes where one produces an error (due to NO unmasking) and the other one succeeds (due to unmasking). I believe this demonstrates 'in context':
i) that indeed the WS can handle delta characters (and would still send a masked value to the IB)
ii) that 'unquoting' / 'unmasking' is required at times (it cannot always "be done for you")
iii) exactly where the compile-time error occurs
... View more
04-25-2023
04:51 PM
Sbxkoenk: Thanks for the reference .. very insightful
... View more
04-22-2023
02:13 PM
Base SAS 9.4.
I am trying to thoroughly understand Macro Quoting (‘masking’) within the context of ‘SAS Processing’ (Input Buffer / Word Scanner / Macro Processor / Symbol Tables (in this case Global only) / Macro Catalog / Compiler)
SAS code examples provided are quite simple but I am trying to breakdown the SAS Process to determine exactly where "unquoting is done for you" as referenced below.
FYI: I really could not find a more abbreviated manner in which to breakdown the various parts of the SAS Process .... so thanks in advance.
/* EXAMPLE 1 */
%let mv1=data test; var='a'; run;
%put &=mv1;
%put _user_;
I understand why Example 1 would fail
Macro Processor
begins to 'execute' the %let statement
adds MV1 to Global Symbol Table
mv1 data test (<< no semi)
The ';' represents an end of statement
";var='a'; run;" is never added to the GST
ERROR 180-322: Statement is not valid or it is used out of proper order.
/* EXAMPLE 2 */
%let mv2=%str(data test; var='a'; run;);
%put _user_;
%put &=mv2;
I understand why we need to use masking as in Example 2
Macro Processor
begins to 'execute' the %let statement
adds MV2 (masked) to Global Symbol Table
mv2 data test; var='a'; run;
>> NOTE: %put _user_; 'shows us' those delta characters
/* create macro variable*/
%let mv3=%str(data test; var='a'; run;);
%put _user_;
%put &=mv3;
/* Example 3a)*/
%macro test;
%put _user_;
&mv3;
%mend test;
%test;
I might expect that Example 3a would fail (given that there is no explicit %unquote to ‘unmask’ mv3 (the masked string found in the Global Symbol Table)).
However, does Example 3a fall under this description (from a SAS blog)?
>>> There are three cases where the unquoting is done for you:
The %UNQUOTE function was used
The item leaves the word scanner and is passed to the DATA step compiler, SAS Macro Facility, or other parts of the SAS System.
The value is returned from the %SCAN, %SUBSTR, or %UPCASE function
And, thus Example 3b (with explicit %unquote) further below is just not necessary?
I have tried to breakdown Example 3a) below in the context of SAS Processing to understand precisely where 'unquoting is done for you'
NOTE: the masked string mv3=%str(data test; var='a'; run;); .. already exists in the Global Symbol Table
Input Buffer
%macro test;
&mv3;
%mend test;
%test;
Word Scanner
detects %macro key word
MP is triggered
Macro Processor
During macro compilation
creates entry in the Macro Catalog
pulls tokens from the Input Buffer to the Macro Catalog until %mend
> %IF etc. as macro instructions
> noncompiled items as text
Macro Catalog
%macro test;
&mv3;
%mend test;
Input Buffer
%test;
Word Scanner
detects % trigger
Macro Processor is triggered
Macro Processor
begins to execute the macro
recognizes non-compiled text
places &mv2 into the IB
Input Buffer
&mv3.;
Word Scanner
continues to tokenize from the IB
recognizes macro trigger '&'
triggers MP
Is it here that the 'item' (the masked string from the Global Symbol Table) leaves the word scanner and is passed to the SAS Macro Facility and therefore, ‘unquoting is done for you’?
Macro Processor
looks in Local (and then Global) Symbol Table and resolves &mv2
>>> mv3 is now clearly unmasked <<<
&mv3; >>> (data test; var='a'; run;)
places non-compiled text into the Input Buffer
recognizes %mend
macro test ceases execution
Input Buffer
data test; var='a'; run;
Word Scanner
continues to tokenize from the IB
recognizes DATA as step boundary
triggers the DATA step compiler
Compiler
data test; var='a'; run;
The compiled DATA step is executed
The DATA step compiler is cleared
Therefore, Example 3b (where %unquote is explicit) is just not needed?
/* Example 3b)*/
%macro test;
%put _user_;
%unquote(&mv3);
%mend test;
%test;
... View more
05-21-2020
08:35 AM
Many thanks again for the replies and insight ChrisNZ. It is appreciated. I marked this as 'solved' accepting the idea that we can't necessarily have SAS make the ODS Excel mimic the exact 'shrink to fit' behavior but we can utilize format and absolute_column_width to acquire a reasonable approximation.
... View more
05-18-2020
02:45 PM
Thank you for the reply ChrisNZ. Your response (of course "max(length(VAR))" .. dah) did help to trigger a solution for using the larger of the variable name length (the excel column header) or the variable value length (the excel 'cell content'). This does allow - dynamically - the excel output to show the full column header when the variable length is smaller than it OR reduce the column width when the 'cell content' is shorter than the header..... so a reasonable solution (code below). But, the ideal solution is still to somehow make the excel column width 'behave' the same as when you manually 'right click on entire column' / format / alignment / 'shrink to fit.' Does anyone know if this is doable ?? (result needs to be output to excel) There are times when a string may be too long to reasonably display inside a cell and so it would be nice to 'shrink it to fit' a defined column width in lieu of having the column width expand to accommodate the long string. (using something like "define var12 / style(column)=[cellwidth=50]" in proc report just wraps the text within the cell and thus expands the cell height ...a result that is not workable. many thanks again for any insight or solutions /* RAW DATA */
data raw;
infile datalines;
input var8 : $8. var3 : $3. var12 : $12. name12_len_3 : $3. var6 : $6.; /* ABCDEFGHIJKL */
datalines ;
123456 123 12345678 123 123456
12345 1 1234567890 123 1
1234567 1 123456 12 2
;
run;
/* i) the variable name length (what will be the excel column header) */
proc sql;
create table var_names as
select varnum, name
from dictionary.columns
where libname='WORK' and memname='RAW'
order by varnum;
quit ;
data name_lengths;
set var_names;
name_length=length(name);
run;
/* ii) the variable value length */
proc sql;
create table var_lengths as
select varnum, name, length as value_length
from dictionary.columns
where libname='WORK' and memname='RAW'
order by varnum;
quit ;
/* result: the greater of i) or ii) */
data ds_lengths;
merge name_lengths var_lengths;
by varnum;
if name_length gt value_length then max_length=name_length;
else max_length=value_length;
drop name_length value_length;
run;
/* place into macro variable */
proc sql noprint;
select max_length into : length_mv separated by ','
from ds_lengths;
quit;
data _null_;
%put &=length_mv.;
run;
... View more
05-17-2020
06:22 PM
Hello, (using base SAS 9.4) Utilizing ODS Excel and/or PROC REPORT, want to make column width 'behave' like excel format / alignment / 'shrink to fit.' Is this even possible? (see attached .xlsx) dm 'log;clear';
/* DELETE FILE */
%let myfile=C:\ods_test.xlsx;
filename myfile "&myfile";
data _null_;
rc=fdelete("myfile");
run;
/* RAW DATA */
data raw;
var4='1234'; /*length=4 #of chars in header=4 */
var8='12345678'; /*length=8 #of chars in header=4 */
header_8='123'; /*length=3 #of chars in header=8 */
run;
ods noresults;
ods html close;
/* ODS EXCEL */
ods excel file="&myfile."
style=styles.htmlblue options(
ABSOLUTE_COLUMN_WIDTH = "4,4,4"
AUTOFILTER ="ALL"
FROZEN_HEADERS="ON"
SHEET_NAME='Data'
);
run;
/* PROC REPORT */
proc report data=raw nowd ;
column var4 var8 header_8;
define var8 / style(column)=[width=75]; /* ?? 'shrink to fit' so that variable value of length 8 fits column width of 4 */
define header_8 / style(header)=[width=5000]; /* ?? 'shrink to fit' so that variable 'header' of length 8 chars fits column width of 4 */
run;
ods excel close;
ods html; If not possible to 'shrink to fit', is it possible to find the 'longer of': i) the given length of the SAS variable OR ii) the width (# of chars) of the 'column header' .. .. utilizing this code snippet as a base? (this might conceivable allow all 'cell content' and/or 'column headers' to be visible in all circumstances). proc sql noprint;
select length into : length_var separated by ','
from dictionary.columns
where libname='WORK' and memname='RAW'
order by varnum;
quit; For my current business purpose, wrapping the text is not ideal but if anyone has observations about that as well, I'll take it. many thanks for any insight
... View more
02-02-2019
03:09 PM
Any insight into which Exam is preferable and/or more 'acknowledged' by prospective employers? They both have similar content and have practice exams offered through Pearson VUE A00-211 SAS Base Programming for SAS 9 A00-231 SAS Certified Specialist: Base Programming Using SAS 9.4 (AKA: 'Performance-based exam') It appears the 'performance' based exam will entail actual programming, which seems like it might better demonstrate ones actual application of SAS knowledge ... But which to choose ? many thanks for any insight or opinions
... View more
12-12-2018
01:46 PM
Looking for insight into using 'dim' of the first array to define the number of elements in a second array. The scenario is when we don't know the number of variables in the raw data and/or want SAS to count them for us The question is in section 2) below but wanted to provide some context to my inquiry .. hope it's clear enough Raw Data: data raw_data;
input fahrenheit1-fahrenheit5;
datalines;
100 75 50 25 0
; 1) Array using {*} and dim for the fahrenheit_array but using celsius1-celsius5 to define the elements of celsius_array data test (drop=i);
set raw_data;
array fahrenheit_array {*} _all_;
array celsius_array {*} celsius1-celsius5; /* << initial 'blank' elements BASED ON THE KNOWN 5 VARIABLES*/
do i = 1 to dim(fahrenheit_array);
celsius_array{i} = 5/9*(fahrenheit_array{i} - 32); /* << element values defined*/
end;
run; 2) How can we define the number of variables needed for the celsius_array based on dim(fahrenheit_array) ????? data test (drop=i);
set raw_data;
array fahrenheit_array {*} _all_;
array celsius_array {*} var1-var ???; /* << HOW CAN WE DEFINE THE NUMBER OF VARIABLES HERE BASED ON DIM(FAHRENHEIT_ARRAY) ??? */
do i = 1 to dim(fahrenheit_array);
celsius_array{i} = 5/9*(fahrenheit_array{i} - 32);
end;
run; many thanks
... View more
09-10-2018
10:02 AM
and ... sorry for the all the "put _all_" in my examples but it REALLY helped me to understand the PDV behavior
... View more