in Education by
I have a query in which I am querying based on few CASE conditions. I want a particular CASE statement to do nothing and skip that case all together. select colA case when colB = 'P' then colC in (colD) when colB = 'Q' then colC in (colE) when colB = 'R' then do nothing from table_A Basically I want that whenever colB encounters value 'R' it does nothing and skips to the next row in table_A. Any way I can do this? If it matters, this is in DB2 Database and will be used in a PROC SQL procedure in SAS Enterprise Guide (Version 8.3) JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
If you want the variable you are creating with CASE expression to be NULL then use the appropriate null or missing value in the CASE expression. Perhaps you mean you want to create the new colB variable to have the existing colB variable's value when it is not P or Q? select colA , case when colB = 'P' then colC when colB = 'Q' then colD else colB end as new_colB from table_A If you don't want the observations with COLB='R' in the results then exclude those using WHERE. select colA , case when colB = 'P' then colC when colB = 'Q' then colD else colB end as new_colB from table_A where colB ne 'R' If you are actually using SAS then skip the SQL completely and just write SAS code to do whatever you want. Then you could actually have statements that are executed conditionally. data want; set mylib.table_A; if colB='P' then do; * some other data step statements ; end; run;

Related questions

0 votes
    Is the following possible in SQL Server 2000? CREATE FUNCTION getItemType (@code varchar(18)) RETURNS int AS ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Is the following possible in SQL Server 2000? CREATE FUNCTION getItemType (@code varchar(18)) RETURNS int AS ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I am trying to create some user defined forms in our ERP system with an Oracle Database. I have ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    What is the Git command to skip staging and commit the changes directly? A. git skip stage B. git commit C. git commit -a -m “message” D. git add changes...
asked Dec 21, 2022 in Technology by JackTerrance
0 votes
    User visits subdomain1.mydomain.com, which sends back cache-control (public, max-age=86400) instructions in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    User visits subdomain1.mydomain.com, which sends back cache-control (public, max-age=86400) instructions in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    Which of these jump statements can skip processing the remainder of the code in its body for a particular ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    How can we skip the bad records in Hadoop?...
asked Aug 5, 2021 in Technology by JackTerrance
0 votes
    In case of any shut down during transaction before commit which of the following statement is done ... Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
+1 vote
    Does a break is required by default case in switch statement in C Programming?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    I use the vendor time picker component. Unfortunately, it uses rem units for most of its sizes, but ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I have an ASP.Net Core project with a simple form that has two radio buttons. One radio button ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    newbie question: how do i make my JSON output ignore null values? I don't want to necessarily set ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    newbie question: how do i make my JSON output ignore null values? I don't want to necessarily set ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
...