This likely is a problem how you compare floating point numbers. Depending on how you generate your numbers on the way to the ADSK table, you could introduce some inaccuracy. Check this:
401 data _null_;
402 base = 5;
403 divide = 3333333;
404 aTear = base / divide;
405 aBucket =...
...like this:
proc sort data=oldTab; by tiliA tiliB; run;
data newTab;
set oldTab (rename=(tiliB=oneB));
by tiliA;
length tiliB $50; /* or whatever length you need */
retain tiliB;
if first.tiliA
then tiliB = left(oneB);
else tiliB = trim(tiliB) !! ' ' !! left(oneB);
if...
You can retain the >new< variable batch_id and increment it according to the specified condition, e.g.
retain batch_id 0;
if job_id eq 1 then
batch_id = batch_id+1;
Plug it into your datastep and you should have the batch_id set properly.
...in and cutting everything around the manufacturer name. Being lazy I coded the cutting as macro to be able to reuse it on different variables.
%*-- cut string OUT from side CUTFROM of string IN with delimiter DLM. ;
%macro mCutStr (in, out, cutFrom=L, dlm=" ");
%if %upcase("&CUTFROM.")...
...names are fix, just add those two to the macro definition. If library and file name could change, add them as parameters with a default assigned:
%*-- create a combined table per year. ;
%macro overall (lib=p_claim, file=file06, year=, maxfile=);
data setted&YEAR.;
set
%do i = 1...
Try something like this to take firstTable and turn it into the larger secondTable (both in WORK library). The "greater-equal" comparison makes sure you do not have an endless loop on days smaller 1.
data WORK.secondTable;
set work.firstTable;
length visit 8;
visit = 1;
do until (visit...
...Dictionary" in "Chapter 3: Formats" the section on MMDDYYw. format for details.
data _null_;
length txtDate $5
numDate 8
;
/*-- as text - not so nice */
txtDate = '0225';
txtDate = substr(txtDate,1,2) !! '/' !! substr(txtDate,3);
put ' Brute Force Text: '...
Thousands of records isn't so bad, I don't think you will see much difference either way - unless sitting on >really< slow CPUs and I/O. You'd need more complex joins and lookups with 100k's or millions of records crossed with thousands to see a real difference. Then things like "SET KEY=" on...
Hi SAP1958,
should go in under 60 lines of code, get introduced to SAS/Macro:
%* MACRO - read all files w/pattern FP in folder BDIR ;
%* store the vautil files in table DS ;
%macro rdVAUTIL (bdir=, fp=, ds=);
%local numFiles;
%let numFiles=0;
%*-- find all files to...
Just specify the funny 3 as a delimiter on the infile and you're set. I also suggest to specify the length of all variables on introduction - it's good practice and avoids any issue with cut-off strings or similar:
data VAUTIL03;
length STATE $2
NDC1 8
NDC2 8
NDC3 8...
You can turn the number via format to a string w/o trailing zeros and remove punctuation with compress. Below example assumes you have max width of 5 characters incl a potential dot.
data x;
val = 23.45; output;
val = 23.4; output;
val = 23.; output;
run;
data _null_;
set x;
length...
These should be no physical SAS columns, they look like column labels of a table view. Spaces, slashes etc are surely invalid (SAS) name characters. You have to get the column names and make the query, then it'll work.
I don't get the rule for filling the f* h* columns. With knowing that and knowing how to reverse order (or using a counter _n_ variable to sort reverse), it shouldn't be hard to retain the values to fill any missing. Can you let us known the rules?
Just to make sure: the SAS format basically changes the >output< format, it does not change the content of the variable. You read in a datetime, you want date only displayed. Add line "BirthDate = datepart(BirthDate);" and you should be set.
Cheers,
Matthias
Alternatively you could work with RETAIN. Assuming your input table is WORK.kids (code not tested):
/* get twins into sequence, female before male */
proc sort
data=WORK.kids;
by idTwin sex;
run;
/* get groups gender */
data WORK.twinGender (keep=idTwin twinGender);
set WORK.kids...
This works for any non-single due to only keeping "cnt gt 1" in the PROC SORT. In your case this will be all twins as the count is 2. The double entries will be single entries in the result of PROC SORT because option "nodup" is specified. So output has moms and their twins.
The following...
Hi, I hope I understood the request correctly - the code does the following after reading in an advanced set of test data with single kids, twins and triplet: using proc sort create a table containing a unique list of mothers and their non-single kids (WORK.twinMom). From that table get the...
Hi,
this is a month ago (didn't visit this for for months), yet maybe this still helps - if I understood the problem right, here you slice nested tags:
data txt;
drop i;
str = 'Out1<text>In1<text>In2<TeXt>Not1</TeXt></text>Post1</text>Out2';
output;
do while (str ne '');
i = index...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.