Create observation count variable - X

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

Create observation count variable - X

 

 

Hi,

I have this data and x variable which I added using this code below the figure: 

 

cancer.PNG

Data Test;
Set T1;
X = _n_;
Run;

What I needed actually was to add the variable X with assigning 1 to each observation.

so I changed the statement to 

Data Test;
Set T1;
X = 1;
Run;

And it did not work ( it says data has 0 observations).

 

Thanks

 

 


Accepted Solutions
Solution
‎05-11-2016 03:43 PM
Super User
Posts: 19,799

Re: Create observation count variable - X

Please post your log, there's no reason it shouldn't work.

View solution in original post


All Replies
Contributor
Posts: 35

Re: Create observation count variable - X

Sorry I had this as a reply to another question (I'm supposed to have a new question since I already closed this one). 

Solution
‎05-11-2016 03:43 PM
Super User
Posts: 19,799

Re: Create observation count variable - X

Please post your log, there's no reason it shouldn't work.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 252 views
  • 0 likes
  • 2 in conversation