
Online
ChrisNZ
Tourmaline | Level 20
Member since
06-23-2011
- 6,996 Posts
- 1,881 Likes Given
- 650 Solutions
- 2,760 Likes Received
-
Latest posts by ChrisNZ
Subject Views Posted 325 4 weeks ago 218 4 weeks ago 388 04-09-2025 02:44 AM 1830 04-05-2025 10:02 PM 358 04-04-2025 05:46 AM 419 04-04-2025 05:45 AM 265 03-29-2025 12:00 AM 1007 03-28-2025 12:21 AM 685 03-28-2025 12:16 AM 324 03-27-2025 11:50 PM -
Activity Feed for ChrisNZ
- Liked Re: JSON based stored process works fine in SAS stpweb app but returns NO data while using API call for BrunoMueller. 2 weeks ago
- Got a Like for Re: How to Write in Bucket s3 Using Bulkload (SAS 9.4M8). 2 weeks ago
- Liked Re: How to get difference for all the numerical value in two rows? for Tom. 3 weeks ago
- Liked Re: How to get difference for all the numerical value in two rows? for Stu_SAS. 3 weeks ago
- Liked Re: How to avoid scientific notation for statistics output for datetime variables for Stu_SAS. 3 weeks ago
- Posted Re: Does SAS9 and Viya Support SQL Server's Linked Server In Libname and ODBC? on SAS Programming. 4 weeks ago
- Posted Re: SQL Query ... CLI prepare error on SAS Enterprise Guide. 4 weeks ago
- Liked Re: printout of Hash Object variable in the SAS log for yabwon. 04-12-2025 12:35 AM
- Liked Re: printout of Hash Object variable in the SAS log for data_null__. 04-12-2025 12:35 AM
- Liked Re: Run multiple macros---write via code and not manually for PaigeMiller. 04-10-2025 04:12 AM
- Posted Re: Add index to a CAS table which is already indexed on SAS Viya. 04-09-2025 02:44 AM
- Posted Re: SAS batch run on SAS Programming. 04-05-2025 10:02 PM
- Posted Re: Why style not applied to SAS Job HTML output? on SAS Programming. 04-04-2025 05:46 AM
- Posted Re: Graph DPI forcing large dimensions on Graphics Programming. 04-04-2025 05:45 AM
- Got a Like for Re: Add SAS Packages Framework to the SAS Base/Viya. 04-04-2025 05:12 AM
- Got a Like for Re: How do i transform data into these? 2 different scenarios here. 03-31-2025 02:29 AM
- Liked Re: ODS RTF Side to Side Graph/Tables for Ksharp. 03-30-2025 05:33 AM
- Got a Like for Re: How do i transform data into these? 2 different scenarios here. 03-29-2025 04:55 AM
- Posted Re: How do i transform data into these? 2 different scenarios here on SAS Programming. 03-29-2025 12:00 AM
- Got a Like for Re: Efficiently Adding a Shifted Date Column to a Large SAS Dataset. 03-28-2025 09:18 AM
-
Posts I Liked
Subject Likes Author Latest Post 2 5 1 1 3 -
My Liked Posts
Subject Likes Posted 1 03-27-2025 11:50 PM 1 06-04-2022 02:52 AM 2 03-29-2025 12:00 AM 1 03-28-2025 12:16 AM 2 03-28-2025 12:21 AM -
My Library Contributions
Subject Likes Author Latest Post 2 1 3 14 3
11-26-2009
04:15 PM
Alternatively you can try this.
Spaces in sas variable names must be used with caution, so I used a _ instead.
You can use a space in the variable label if you want.
[pre]
data SAMPLE;
infile cards truncover;
input A $16.;
cards;
USA SAS
EARTH WORLD
run;
data STEP1;
set SAMPLE;
length NAME $16; * set variable name length;
retain NAME; * variable name is built across several obs;
VALUE=scan(A,2); * build values;
NAME=catx('_',NAME,scan(A,1)); * build variable name;
call symput('varname', NAME); * save variable name;
run;
data STEP2;
set STEP1 (keep=VALUE rename=(VALUE=&varname)); * use variable name;
run;
... View more
11-26-2009
03:33 PM
I don't know R, but could it be something like:
[pre]
select name
,age
,ifn(age>mean(age),1,0) as old
,ifn(age
from sashelp.class;
... View more
10-28-2009
09:41 PM
I don't see why it shouldn't work, and it almost does.
Some parameters seem to cause issues though. This works:
dm log "clear";
signon _001 sascmd="!sascmd" ;
data _null_;
call sleep(5,1);
put "==> Wait for signon 1";
run;
rsubmit _001 wait=no macvar=JOB001 signonwait=y persist=n ;
data _null_;
put "==> Rsubmit on _001 ok";
run;
signon _002 sascmd="!sascmd" ;
data _null_;
call sleep(5,1);
put "==> Wait for signon 2";
run;
libname rwork server=_002 slibref=work;
******rsubmit _002 wait=no signonwait=y persist=n ;
rsubmit _002 wait=yes;************* works with this change ;
data _null_;
put "==> Rsubmit on _002 ok";
run;
endrsubmit ;
endrsubmit ;
... View more
10-28-2009
07:15 PM
SIZE is an unsupported annotate function for labels for Activex.
Java should support it though.
Hit F1 and look for "ActiveX support, Annotate functions" if you have 9.2 to see if this has improved (and let us know).
... View more
10-28-2009
06:32 PM
OldTimer is right. Unquoting is sometimes hit and miss.
The only way I could make this work is by using
proc sql noprint;
select distinct trim(&attrib) into :&attrib._1 - :&attrib._4 from test;
quit;
and then
%unquote(&lefty.ratio_&&&attrib._1&lefty.n)=N/195;
I am unsure why you'd want to carry these hideous names in the data step instead of calling the new variables INFO1-4 and RATIO1-4 though.
This would also allow you to write
RATIO[CLASS_N]=N/195;
instead of doing successive tests.
... View more
10-27-2009
10:46 PM
Use Scott's links to understand the following:
[pre]data OUT;
input PAT_ID MONTH1 MONTH2 MONTH3; * can be written input PAT_ID (MONTH1-MONTH3)(:);
if MONTH1 then do;
MONTH1=sum(of MONTH1-MONTH3);
call missing(MONTH2, MONTH3);
end;
else if MONTH2 then do;
MONTH2=sum(of MONTH1-MONTH3);
call missing(MONTH1, MONTH3);
end;
else if MONTH3 then do;
MONTH3=sum(of MONTH1-MONTH3);
call missing(MONTH1, MONTH2);
end;
else call missing(of MONTH1-MONTH3);
cards;
1 0 1 2
2 1 1 2
3 2 0 1
4 0 0 3
5 3 0 0
6 0 0 2
7 0 2 0
8 0 2 2
;
run;
[/pre]
If you had many months, you'd loop thru them using an array, as Scott said, rather than adding tests.
One step at a time though.
... View more
10-27-2009
10:29 PM
Have you read the CEDA pages?
Particularly:http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002143983.htm
Also about data migration:
http://support.sas.com/rnd/migration/planning/files/crossplatform.html
Why CEDA Is Invoked for a SAS®9 File in a SAS®9 Session
Character encoding: CEDA is invoked when you share a file with users in another locale who have an incompatible encoding. For more information, see the topic about national language support or see Processing Data Using Cross-Environment Data Access (CEDA) in SAS Language Reference: Concepts.
Operating environment family: In a SAS®9 session, you can run the CONTENTS procedure on any SAS®9 file to determine the operating environment where it was created. To learn the operating environment of your current SAS®9 session, create a quick data set and run PROC CONTENTS on it. If the data representation of the file matches that of your current operating environment, then the file is native on that operating environment. If you're running under AIX, Solaris, or HP-UX, you'll notice all of those operating environments are listed in the log, because those operating environments comprise an operating environment family.
To know when CEDA is being used, set the SAS system option MSGLEVEL=I. That is:
options msglevel=i;
Here's an example of the message that displays in the log:
INFO: Data file MYFILES.GRADES.DATA is in a format that is native to
another host, or the file encoding does not match the session encoding.
Cross Environment Data Access will be used, which might require
additional CPU resources and might reduce performance.
Beginning with SAS 9.1.3 Service Pack 4, you get this behavior even if you do not specify MSGLEVEL=I.
Run proc contents, and use the OUTREP= option if needed.
... View more
10-27-2009
09:54 PM
The code above does not work. Please check before posting.
I want ALL records for EACH gender whose maximum value for age is in the interval [16,17]:
select *
from sashelp.class
group by sex
having 16 le max(age) le 17
;
... View more
10-27-2009
09:33 PM
How about you use the description and :
1- replace F10.3 by 10.3
2- replace I5 by 5.
to create the input statement.
On the data side (in the file):
1- replace StarSpace with SpaceDot
Would that work?
... View more
10-27-2009
08:05 PM
It'd be good that you post code that anyone can run.
For eg, replace your data with sashelp samples.
... View more
10-27-2009
07:28 PM
You'll need something like this:
[pre]
data OUT;
set SASHELP.CITIDAY(keep=DATE SNYDJCM);
DSID=open('SASHELP.CITIDAY(keep=DATE SNYSECM where=(DATE > "10jan1988"d and (DATE between ' ||
put(DATE-1,5.)||' and '||put(DATE+1,5.)||')))');
RC=fetch(DSID);
if RC=0 then
do while(RC=0);
SNYSECM=getvarn(DSID,varnum(DSID,'SNYSECM')); *replace varnum() by the number to speed up a wee bit;
output;
RC=fetch(DSID);
end;
else output;
RC=close(DSID);
run;
[/pre]
(I left join the table to itself within 1 day here).
Also, you'll need an index on the secondary table of course.
If you have version 9.2, you might want to look at hash tables as this version allows hash tables with non-unique keys.
2 dates + cusid + w/off + interest occupy 4+4+8+8+8=32 bytes. That's 33 million rows per GB of RAM.
Otherwise, the logic above with the secondary table loaded in memory using a sasfile statement is another option.
Message was edited by: Chris@NewZealand
... View more
10-14-2009
08:14 PM
Thanks Curtis.
Rows are read only once (if applicable) and retained (and potentially over-written), not read over and over as SQL does.
It makes perfect sense now.
A cartesian product is probably more useful (as well as more resource-intensive) than this behaviour, but as long as we are aware of what takes place ...
... View more