BookmarkSubscribeRSS Feed
Sandeep77
Lapis Lazuli | Level 10

Hi all,

I am trying the find the distinct icustomerid. But when I do that it does not give me the other columns from the previous table. I want the output to just show the distinct icustomerid with all the columns from the previous table. Here is a sample dataset:

Data Test;
infile cards expandtabs;
input icustomerid debt_code Lettered;
datalines ;
125 4413245 1
125 4426817 1
782 4423817 2
972 4422740 2
1052 4429532 2
1052 4419588 1
1052 4419420 3
2294 4428625 3
;
run; 

Proc sql;
create table distinct_customer as 
select distinct icustomerid
from All_letters;
quit;
3 REPLIES 3
ballardw
Super User

What is a "previous table"?

 

You need to provide an example of the desired output given your input example data set.

PaigeMiller
Diamond | Level 26

Please show us the desired output from this data and from this PROC SQL. If you want distinct levels of icustomerid, its not clear what you want to see in the other columns.

 

PS: from now on, please show us the desired output, rather than making us ask.

--
Paige Miller

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 640 views
  • 2 likes
  • 4 in conversation