Quantcast
Channel: User Joe - Stack Overflow
Browsing latest articles
Browse All 46 View Live

Comment by Joe on SAS Enterprise Guide export as step in process path selection

Sorry, I don't have an EG 7 install anymore. Strongly recommend you upgrade to EG 8, it definitely supports what I describe. It's about 3 years old now, so long past time to upgrade.

View Article



Comment by Joe on Copy a Azure table (SAS) to a db on Microsoft SQL Server

@jarlh - sas is almost certainly not relevant here, it refers to a programming langauge, not shared access signatures which is the more common usage of 'SAS' in this context.

View Article

Comment by Joe on Convert if else condition with "dot" in SAS to R

Similar - that is if nopa is null or 1.

View Article

Comment by Joe on Effectively read multiple excel sheets from an xlsx excel...

don't imagine you could run them in parallel anyway, because SAS will lock the excel files.

View Article

Comment by Joe on Issues with TRANWRD in SAS

@MWallace This seems like a good question by itself, with example code.

View Article


Comment by Joe on Type of date as prompt

Why are you mixing data step language and macro language?

View Article

Comment by Joe on Transposing Health and Retirement Study variables into long...

It's not really clear what you want your output to be, so hard to help unfortunately.

View Article

Answer by Joe for SAS using array to select status prior to event date

For this, the easiest way to do it if the months are consecutive is to just directly access the column based on the value of the diagnosed_date. This only works, though, if everything is aligned right...

View Article


Answer by Joe for SAS using array to select status prior to event date

Here's a different answer: the way I'd do it in real life.The issue here is your data structure. You usually don't want to store data in arrays like this where the name of the variable means something....

View Article


Answer by Joe for Convert character variable to numeric variable in SAS

The typical thing to do here is to find out what's actually in the character variable. There is likely something in there that is causing the issue.Try this:data have;input @1 Dosis...

View Article

Answer by Joe for SAS EG How to compare cell values in an array loop?

data want; set have; array c{*} col:; do i = dim(c) to 2 by -1; *no reason to check #1; if c{i} = c{i-1} then call missing(c{i}); *if identical to prior, clear out; end;run;You don't need two loops -...

View Article

Answer by Joe for Functions in SAS

The typical way you'd do this is in a SAS Macro. %macro func(x); -log10(20/&x) %mend func;data whatever; set yourdataset; l = %func(x);run;You can also of course just directly use it in code if...

View Article

Answer by Joe for Run the same SAS program in parallel with different argument

There are at least ten different ways to do this, both on SAS 9.4 and SAS Viya. Viya is a bit more "native" to this concept, as it tries to do everything as parallel as possible, but 9.4 would also do...

View Article


Answer by Joe for Set initial values for solving nonlinear equation by SAS...

I don't know anything about the kind of nonlinear solving you're doing, but at minimum you can loop it:proc iml;start Fun(var); x = var[1]; f = j(1, 1, .); /* return a ROW VECTOR */ f[1] =...

View Article

Answer by Joe for I need to programmatically identify all libraries and data...

SAS has a procedure that does this, PROC SCAPROC. If you do have access to SAS, this is by far the best solution. You would technically need to run SAS, but even if there are errors, in theory it might...

View Article


Answer by Joe for How to zip multiple datasets from different folders in one...

It's not possible to answer for your macro without seeing the macro, but there are ways to zip files in SAS, and here's...

View Article

Answer by Joe for Difference calculation between two percentages in sas

The first table is trivial out of proc tabulate.data test_data; input test_control $ loans approved risk $; datalines;test 1 1 lev1test 0 1 lev2control 1 1 lev3test 0 0 lev1control 1 1 lev2test 1 1...

View Article


Answer by Joe for Why in SAS data step where works but not if

The most similar solution is to use prxmatch:data t2; set t1; if prxmatch("/.*SR/ios",a);run;Note that this is much slower than WHERE with LIKE, and Tom's solutions are faster if there's a reasonable...

View Article

Answer by Joe for Conditional PROC SQL on SAS

Two good ways to do this, I think.First: the easy hack.%let COD_COC =(52624, 52568, 52572);%let COD_BLOC = (and t1.cd_bloc in (...));%let COD_BLOC = ;proc sql; create table work.abordados as select...

View Article

Answer by Joe for Searching and importing all .csv files in a target directory

As regards the requested call execute line, this will not work.call execute(cats('%importcsv('&path.\&&file&i')'));The cats is not properly constructed. It's unclear why you're even...

View Article

Answer by Joe for SAS filter date for the last three months from the start of...

threemonths = put(intnx('month', &today, -3, 'same')That's close! Do you happen to know what the 'same' parameter does? It's an alignment specifier. See the intnx documentation for the other...

View Article


Answer by Joe for Can I use Perl-regular expressions in SAS to add...

Honestly, I wouldn't; regex are not faster for the most part than just straight-up checking with normal code, for simple things like this. If you have time pressure, or thousands or millions of rows......

View Article


Answer by Joe for How to convert character type date to date type in SAS

SAS date variables are stored as number of days since Jan 1, 1960. For a variable that is Month and Year only, you'd need to pick a day - many choose the 1st, some the 15th or 30th/31st, depending on...

View Article

Answer by Joe for How can I connect to SAS CAS Server

Do you have an authinfo file set up, or are you using Kerberos? The error at the top of the first seems like a kerberos issue, but it may actually be an issue with authinfo - see the troubleshooting...

View Article

Answer by Joe for SAS-sgplot-add label to bar clusters

Assuming you have SAS 9.4 TS1M2 or later, you have an option, seglabel, which specifically does this, other than the 'display only once', which I don't think is a thing you can get out of the box.proc...

View Article


Image may be NSFW.
Clik here to view.

Answer by Joe for Beginning and end week date in SAS Visual Analytics

This may depend on what version of SAS Visual Analytics you're using, but in mine (8.5.2), this is not directly possible, but you can get at this using old methods.Using New Data Item -> New...

View Article

Answer by Joe for SAS set the 'middle' parameter of intnx to always set to...

If you literally want it to be the 15th exactly, then why not do this?date1=put(intnx('month',today,0,'b')+14, date11.); Seems straightforward to me...

View Article

Answer by Joe for Regex For Matching URLs that Share Portions of the Same Format

With negative lookahead, you can do something like this:\/api\/(?!.+?\/approval).+Basically, put the thing you don't want (so, a bunch of chars followed by \approval) entirely in the lookahead.

View Article

Answer by Joe for Looking for a more efficient way to pull data from multiple...

First, parallelization will help immensely here. Instead of running 1 job, 1 dataset after the next; run one job per state, or one job per year, or whatever makes sense for your dataset size and CPU...

View Article



Answer by Joe for how to group data by product in this particular dataset

A better data structure for this would bemonthcustomer_idproduct_numJan11Jan13Jan1nThis would allow you to group by product number (or product name or whatever makes the most sense).

View Article

Answer by Joe for Type of date as prompt

This is a fine approach, just no reason to mix the macro language with the data step language.DATA_ = INPUT("&Prompt_DATA.", ANYDTDTE.);IF (INDEXC("&Prompt_DATA_LABEL.", ',')) THEN...

View Article

Answer by Joe for Subsetting IF Statement - Why is the following step wrong?

between is not a SAS operator. It's legal in SQL contexts (see this article), including where statements which use SQL operators, but it is not legal in normal data step code.

View Article

Answer by Joe for Hi, I have a text(.txt) file that has millions of rows...

If you're using a data step to read this in, you can do this fairly easily.data want1 want2 want3 want4; infile yourfile; input [stuff]; if _n_ lt 1000000 then output want1; else if _n_ lt 2000000 then...

View Article


Answer by Joe for how to correctly read error code in SAS macro loop?

You've got a timing issue here. Your macro %rerun is using the &syscc defined as it is before anything happens!The way to think of this is to see this as having 2 passes. First the "macro" pass,...

View Article

Comment by Joe on check for content change of a web site

This question is over ten years old, but you can suggest a close-as-duplicate if you want as it does look like that question has better answers (though I don't know anything about entity tags, so don't...

View Article

Comment by Joe on Transform into decimal preventing trimming 0s

This doesn't match the (impossible to really match!) results, unfortunately (look at 481).

View Article


Comment by Joe on Transform into decimal preventing trimming 0s

No idea if this is why, but the one place that is not true is when considering precision in scientific work; 428.0 is different from 428 in that 428.0 shows it is more precisely measured.

View Article


Comment by Joe on Loop and register the result of every update

What's random about that? You're running the same proc freq on the same dataset 100 times, of course it's the same. What do you actually want to do?

View Article

Answer by Joe for Transform into decimal preventing trimming 0s

What you want is a character variable, not a numeric variable; that's the only thing that can perfectly match what you are asking for.The way to handle this is to keep the true numeric, then to store...

View Article
Browsing latest articles
Browse All 46 View Live




Latest Images