In Data Prep, I have the following code which is working great:
proc sql noprint;
create view TEMP_LASR_VIEW_1234 as
SELECT
X.EmployeeID,
X.EmployeeName
FROM
LASRLIB.MyTable X
quit;
/* Drop existing table */
%vdb_dt(LASRLIB.EMPLOYEES);
data LASRLIB.EMPLOYEES ( );
set TEMP_LASR_VIEW_1234 ( );
run;
Now I want to alter this code to insert a hard-coded row in the same data prep script. I tried doing a UNION statement:
SELECT
X.EmployeeID,
X.EmployeeName
FROM
LASRLIB.MyTable X
UNION
SELECT
0,
'EMPTY ROW'
but i keep getting the "Syntax error, expecting one of the following: a quoted string, ',', AS, FORMAT, FROMSELECT X.EmployeeID, X.EmployeeName FROM LASRLIB.MyTable X" error.
What is the correct syntax for using hard coded values in this scenario?
Thanks @LinusH
I ended up referencing the table and then just capping the select statement to a single row to avoid multiple entries going into the table:
SELECT
X.EmployeeID,
X.EmployeeName
FROM
LASRLIB.MyTable X
UNION
SELECT
0,
'EMPTY ROW'
FROM
LASRLIB.MyTable X (obs=1)
WORKED!
As I can recall, SELECT requires a FROM clause.
So you might need to refer to a row stored in an existing table, rather than hard code the values.
Thanks @LinusH
I ended up referencing the table and then just capping the select statement to a single row to avoid multiple entries going into the table:
SELECT
X.EmployeeID,
X.EmployeeName
FROM
LASRLIB.MyTable X
UNION
SELECT
0,
'EMPTY ROW'
FROM
LASRLIB.MyTable X (obs=1)
WORKED!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.