Plese help me to ave solution of the following problem.
Write a shorter query using SAS arrays to replace '0's as missing values in “Online Orders.csv” dataset. Use asterix(*).
@NVN wrote:
Plese help me to ave solution of the following problem.
Write a shorter query using SAS arrays to replace '0's as missing values in “Online Orders.csv” dataset. Use asterix(*).
Sounds like homework. How about you post what you've tried and we can help with any issues you have.
Here's a tutorial that may be helpful and probably really has the answer you need:
https://stats.idre.ucla.edu/sas/seminars/sas-arrays/
Write a shorter query using SAS arrays to replace '0's as missing values in “Online Orders.csv” dataset. Use asterix(*).
I executed the following code.
Data online;
set online;
array miss_val=_all_;
if miss_val=0 then miss_val="*";
run;
Am using virtual lab facility for sas. So when i execute this query the Error that am seeing is "Unfortunately your server has terminated."
when i use " _numeric_ " insted of " _all_ " the following error is displaying.
ERROR : Array subscript . out of range [1- 6] of dimension 1 of array miss_val at line 100 and column 4.
when i use " _character_ " insted of " _all_ " the following error is displaying.
ERROR : Array subscript . out of range [1- 14] of dimension 1 of array miss_val at line 110 and column 4
Please take a look at the documentation for the ARRAY statement. At least then you will know the proper syntax for your array statement. http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201956.htm
In that documentation, please see Example 5, it is similar to what you want to do.
1. How do you declare an array - your declaration is incorrect.
2. You're going to need to lop through the array but you have no loop
3. The asterisks comment is in reference to declaring an array.
Heres a start for you. Review the link I included above. The first example is almost exactly your question.
Data want;
Set have;
Array nums (*) _numeric_;
*loop start goes here;
* change to 0 goes here;
*loop end goes here;
Run;
Write a shorter query using SAS arrays to replace '0's as missing values in “Online Orders.csv” dataset. Use asterix(*).
I executed the following code.
Data online;
set online;
array miss_val=_all_;
if miss_val=0 then miss_val="*";
run;
Am using virtual lab facility for sas. So when i execute this query the Error that am seeing is "Unfortunately your server has terminated."
when i use " _numeric_ " insted of " _all_ " the following error is displaying.
ERROR : Array subscript . out of range [1- 6] of dimension 1 of array miss_val at line 100 and column 4.
when i use " _character_ " insted of " _all_ " the following error is displaying.
ERROR : Array subscript . out of range [1- 14] of dimension 1 of array miss_val at line 110 and column
There's no need for multiple threads on the same topic with the exact same question. Let's continue the discussion in your other thread. https://communities.sas.com/t5/SAS-Studio/Arrays/m-p/364040#M2643
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.