Recently in the SAS Community Library: Your often contains the information you need, but not sequenced in the order required for processing. @SASJedi shows you how to properly sequence data so you can compare the data in one table to the data in another, conduct merges or joins and more.
Brand new to SAS. I'm doing something that I expect is relatively easy, but I'm struggling to get it right. The requirement is basic - I'm reading in a long file with many rows, if a record matches a criteria I want it to be shipped to a different "bypass" file that I'll work on in a later process, but it should be removed from the original read-in file. Environment is zOS - input file is defined and passed in via JCL (all working). I get the following errors if I remove my actual logic - if I leave the FILENAME statement in without referencing it there's no errors. ERROR: Invalid logical name. ERROR: Error in the FILENAME statement. ERROR: Invalid file, BYPASS_FILE. FILENAME BYPASS_FILE BYPASS1;
/***********************************************************/
/* READ FILE */
/***********************************************************/
DATA DATAIN;
INFILE DATAIN;
INPUT
@ 00001 RECORD_NUMBER $CHAR8.
@ 01769 COMPONENT_STATUS $CHAR1.
;
/*******************************************************************/
/* CREATE BYPASS FILE - USED TO STORE RECORDS WHICH HAVE AN */
/* INACTIVE COMPONENT: COMPONENT_STATUS = I */
/*******************************************************************/
IF COMPONENT_STATUS = 'I' THEN DO;
FILE BYPASS_FILE;
PUT;
DELETE;
END;
... View more
I have a dataset Id system1 system2 system3 system4 1 0001 0001 0001 0002 2 0002 0001 0002 0003 3 0003 0002 0002 0004 4 missing 0001 missing missing I want to the new data set to include a new column which is the most frequent value across these systems. Id system1 system2 system3 system4 mostfrequent countofmostfrequent 1 0001 0001 0001 0002 0001 3 2 0002 0001 0002 0003 0002 2 3 0003 0002 0002 0004 0002 2 4 missing 0001 missing missing 0001 1 Any help you can provide would be greatly appreciated!
... View more
Hi,
I'm currently waiting to get access for sas viya but I have a test case scenario to compare between sas eg and sas viya and just want to verify the sas viya code. For bootstrapping in sas eg I have this code
proc surveyselect data=data
out=BootSamples noprint
seed=25
reps=2000
method=urs
samprate=1
outhits;
run;
Am I right that this would be the equivalent code in sas viya or am i missing something?
/* Start CAS session and load data into CAS */
cas mysess sessopts=(caslib='casuser');
libname mylib cas sessref=mysess;
/* Load example data */
proc casutil;
load data=data casout="sample" replace;
run;
/* Perform bootstrap resampling using the sampling action set */
proc cas;
action sampling.srs result=r /
table={caslib='casuser', name='sample'}
output={casout={caslib='casuser', name='BootSamples', replace=true}}
samppct=100 /* Sampling rate of 100% for bootstrap */
method='URS' /* Unrestricted random sampling with replacement */
seed=25 /* Seed for reproducibility */
reps=2000; /* Number of bootstrap replicates */
selection={name='Freq', includeFreq=true}; /* Include frequency counts in the output */
quit;
/* Fetch and display some of the bootstrap samples (Optional) */
proc cas;
table.fetch / table={caslib='casuser', name='BootSamples'} to=10;
quit;
/* End CAS session */
cas mysess terminate;
... View more
Thanks to a little math help from StackExchange, here's a SAS ODS Graphics Happy Father's Day greeting!
* Fun w/SAS ODS Graphics: Happy Father's Day! (Scatter + Polygon + Text Plots)
Star vertices algorithm from math.stackexchange.com/questions/3582342/coordinates-of-the-vertices-of-a-five-pointed-star;
data star; * Generate points for stars;
retain id 0 r1 6 r2 2.5 dad "DAD" xT 0 yT 0; * Star outer radius is 6, inner radius is 2.5;
pi=constant("pi");
do pt=1 to 600; * Points for 600 little Unicode stars;
xS=-6.25+12.5*ranuni(123); yS=-5.75+12.5*ranuni(456); output;
end;
xS=.; yS=.;
do k=0 to 4; * Points for 1 big polygon star;
x=r1*cos(2*pi*k/5+pi/2); y=r1*sin(2*pi*k/5+pi/2); output;
x=r2*cos(2*pi*k/5+pi/2+2*pi/10); y=r2*sin(2*pi*k/5+pi/2+2*pi/10); output;
end;
ods graphics / reset width=5in height=5in noborder; * Make Dad a star!;
proc sgplot noautolegend aspect=1 noborder nowall pad=0;
styleattrs backcolor=navy;
symbolchar name=uniStar char='2605'x; * Unicode value for 5-pointed star;
scatter x=xS y=yS / markerattrs=(symbol=unistar color=White size=24pt); * Plot little unicode stars;
polygon x=x y=y id=id / fill fillattrs=(color=cxd9d9d9) dataskin=crisp; * Plot big polygon star;
text x=xT y=yT text=dad / contributeoffsets=none textattrs=(size=48pt color=navy weight=bold) contributeoffsets=none; * "DAD";
xaxis display=none values=(-6.25 6.25) offsetmin=.01 offsetmax=.01; * Hide axes;
yaxis display=none values=(-5.75 6.75) offsetmin=.01 offsetmax=.01;
run;
... View more
Boa tarde, tenho duas tabelas e gostaria de gerar/exportar um arquivo único, em que, cada tabela ficasse em uma aba do excel. Como fazer este procedimento?
... View more