821 questions
0
votes
0
answers
70
views
Empty SAS Studio Error when using large Work Tables imported from PostgreSQL DB
This might be related to this question, but in my current SAS Viya Stable 2024.12 environment I encounter an empty Error Message and the SAS Studio session context breaks, while trying to do a SELECT ...
0
votes
1
answer
106
views
Unkown Error & Session Problem Detected when loading large Postgres Tables into SAS Studio
What I encountered
I'm programming with Flows in SAS Studio in the ViyaCloud. While trying to load large Tables from a PostgreSQL Database I encountered the following error combination:
Two Error Pop-...
0
votes
0
answers
50
views
Euklidean distance from each point to every other point in Python + solution with proc sql
I would like to calculate distances from each point to every other point in Python and I want to do it with a loop.
I have a solution with proc sql and I tried it with Python but I got different ...
0
votes
2
answers
163
views
Sas equivalent function to SQL Server group by cube
I have recently discovered the cool SQL Server group by cube function that summarize the result without a lot of coding. Does SAS have the same without appending a lot of proc summaries. Sample code:...
0
votes
1
answer
56
views
Using and Creating SAS Macro in the same step
The macro below (the into :&count is causing issues). Although it doesn't show an error, later when I call salescount, it's clear the macro was not assigned properly "Apparent symbolic ...
0
votes
3
answers
139
views
Condition is not working - Send email SAS GUIDE
I have to do a condition in SAS Guide if the SYSERRORTEXT is blank or not, but the code that I created is giving me only the value 0, indicating that the code is not good, even I received the e-mail. ...
0
votes
1
answer
97
views
SAS Macro Proc SQL w/ Multiple Conditions
I'm trying to run a proc sql macro that contains multiple conditions strung together. Is there a way to correct the code below for the 2nd macro (rn_cnt) or is there a better approach? Background: ...
0
votes
2
answers
93
views
SAS proc sql, how to find out the missing rows in a yearly table for each claim case?
I am working on a yearly table for claim cases. the goal is for each existing claim, there should be one row at the end of each year to reflect the situation of that claim case.for example claimA has ...
0
votes
1
answer
115
views
Joining true date to text date in SAS/proc sql
I need to join on ~today (or an arbitrary date in the past for checking)
to a large lake based table using SAS/proc sql. I'm struggling because the lake table uses hardcoded text columns for dates. I ...
0
votes
1
answer
25
views
proc sql left merge on the most recent date for each row
I am trying to make this code work but for some reason it gives me a lot of duplicates. Table1 has 75k records and I would like to get data from Table2 against each row. Please help me:
proc sql;
...
0
votes
1
answer
161
views
PROC SQL left join on id and date not working
I am trying to merge two tables with below code:
proc sql;
create table test as
select a.*, b.*
from aaa a
left join bbb b on a.id=b.id and a.date1<=b.date2;
quit;
But the output shows blanks in ...
0
votes
2
answers
388
views
PROC SQL, can't filter datepart between date converted from numeric
I have a SAS table sastable that I'm joining with a column from a SQL database to create a new table. However, I need to filter the sql.data with a date column from sastable. sastable.date is already ...
-1
votes
1
answer
137
views
PROC SQL IN SAS
Can you write a code in Proc SQL in SAS where we have to add a new column named StudentName to Student table which can be blank
Can you provide a example scenario
Like what are the steps to do that ...
-1
votes
1
answer
674
views
Does SAS Proc SQL allow windowing functionality like Over Partition By
I have standard sql code which I need to use in SAS Proc SQL, however that code contains a lot of iterations of windowing functions like Over Partition By. I wanted to know if SAS allow that if not ...
-1
votes
1
answer
46
views
Identical where conditions giving different results
Why are these two queries not giving the same result?
PROC SQL;
CREATE TABLE NAME_MATCHING AS
SELECT t1.\*
FROM WORK.table1 t1
WHERE t1.names contains name1
OR t1.names contains name2
OR t1....
0
votes
1
answer
95
views
Obtain the first row of a column with proc sql
Given a script below,
for each team, the top earner for players that have at least 30 assists;
proc sql;
create table basketball_summary as
select team, salary, first(case when nAssts >= 30 then ...
1
vote
1
answer
63
views
SAS Data Set Setting Variables of data set to add line numbers
I have the following dataset
Id
com
typ
cust
bu
tar
item
item_sufx
part
line
dtn_cd
10
ARF
3
2585
12
100
4587
800
1
1
1
10
ARF
3
2585
12
100
4587
800
1
2
1
10
ARF
3
2585
12
100
4587
800
1
3
2
22
XYZ
3
...
0
votes
1
answer
259
views
How can I use Proc Sql 'Case When' Conditional for Multiple Rows of Same Group
I want to create a three indicators for a variable. I have a dataset that looks like this:-
ID Group Color
1763 A Red
1763 A Yellow
6372 B Red
0498 A Red
I want to ...
0
votes
1
answer
101
views
SAS STUDIO - Error with Inner join syntax
I have 4 tables; PREFIX, FORENAME, MIDDLENAME, SURNAME. With an common column "row_num". I am taking the fuzzy matched scores out of each table, name PFX_SCR etc...
This is my current code:
...
0
votes
1
answer
101
views
Merge/Group data in SAS
I have the following dataset
Id
com
typ
cust
bu
tar
item
item_sufx
part
line
dtn_cd
geo_con
sign
10
ARF
3
2585
12
100
4587
800
1
1
1
ZL-UK-23
+
10
ARF
3
2585
12
100
4587
800
1
2
1
ZL-US-22
-
10
ARF
3
...
0
votes
2
answers
196
views
How to create looping macro in SAS/ Proc SQL
I need to write code that performs the same action over and over, but using a different macro variable name each time. I've done this before, but can't quite remember the syntax.
Summary: I need to ...
0
votes
1
answer
104
views
Self join - update a variable - proc sql
I have this table:
data MyTable;
input Household age gender $ flag;
datalines;
1 45 male married
1 35 female married
2 50 female married
2 52 male married
3 32 male child
3 50 male married
3 ...
0
votes
1
answer
366
views
Getting month and fiscal year from columns SAS
I have a table with the following type of data
FISCAL_YEAR
MTH
Month_Name
FY2018
6
JUN
FY2017
5
MAY
FY2022
10
OCT
I want to get current fiscal year (i.e. FY2023 for this instance but FY2024 next year) ...
1
vote
2
answers
527
views
catx function where columns are null
I am working with catx function in sas enterprise guide.
When I want to concatenate 2 columns I am using
catx('-',column1,column2)
It works fine but when both column1 and column2 are null it still ...
0
votes
1
answer
84
views
Comparing two strings without the last word
I have a dataset with two name variables. I want to compare both names, but excluding the last word from them before the comparison. This is because sometimes married people change their last names.
...