I am a SAS-novice, and working through the book of Andy Field and Jeremy Miles "Discovering statistics using SAS".
I am encountering all kind of smaller hiccups doing the exercises in the book, what has to do with the SAS-program (and not with the statistics itself).
What is the proper platform/community for my questions. I will give one example.
One of the datafiles to be used for the exercises misses for some unknown reason a vairiable ID. I now want to create a variable (vector) ID with 50 records from 1 to 50, and to add that to the datafile. Of course I can add the data manually, but I want to learn to write some simple code. In R this is no problem for me. But is SAS I ran into troubles.
I created a vector V as follows:
Then aI tried to add that to the dataset
DATA set2; SET set1;
Then in set2 two new empty variables have been created ID and V.
Most of your questions can be posted under SAS Programming >Base SAS Programming.
Proc IML is not part of Base SAS. You can mix and go between data steps and Proc IML, but if you're new it might not be the best idea.
IML treats data like R, arrays/matrices and column functions. Base SAS does not, it goes through data line by line.
That being said, if you want to add a row identifier of 1 to 50 to your data set you can use the automatic variable _n_. I'm not sure what you're trying to do with the 1 to 50 so this may or may not make sense. A great way to ask questions is to show the current structure/sample of your data and your desired output.
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.