It's physically impossible for a pig to look up into the sky from a standing position. Imagine about a pig for a while. The anatomy of their neck muscles makes it very difficult to bend their neck backward more than a certain angle. They are evolved in a way to have a better vision of their food and escaping from predators.
They can look up, but not as we can bend our neck to gaze at the sky. To gaze at the stars, they must roll on their backs and look upwards.
However, pigs are considered social animals and they always communicate with each other through making noise. They can be trained to perform tricks and can become a good friendly pet to have at your home. And it's not true that they love to lay on the mud and are always dirty. They lie on the mud to make them cool and to protect them from the sun. Otherwise, they love to be clean and fresh and to live with you inside your house like a dog or a cat.